0

I want to change howPost() function name to articlePost() using jQuery after clicking a button. I simply want another function to run after clicking it. How do I accomplish that?

<?php
  for($i = 0; $i <howPost(); $i++){
    echo drawPost($i+1);
  }
?>
Mr. Alien
  • 153,751
  • 34
  • 298
  • 278

2 Answers2

0

You can't "change" your PHP file using jQuery, PHP is executed server-side. So once you have your response, all you can do is another HTTP request to the server, check this SO accepted answer.

It should clarify things for you. Hope it helps.

rbock
  • 625
  • 5
  • 15
0

You need Ajax to accomplish that. https://api.jquery.com/jQuery.ajax/

You create an html form with html and then add EventListeners with e.g. jQuery which triggers the form using ajax. Ajax makes an actual HTTP-Request which processes the data sent along with the ajax call.

Alexander
  • 501
  • 1
  • 6
  • 16