Skip to content Skip to sidebar Skip to footer

Button To Call A Php Function?

I am new to javascript world. I wrote a function in PHP. How do I call it when I click a button or image in html?

Solution 1:

If you want to call serverside functions you should use AJAX.

Goto http://www.w3schools.com, and take the AJAX tutorials.

Solution 2:

You have a general missunderstanding.

PHP is serverside, HTML/JS is clientside.

so if you want to call a server method from clientside you have to execute a request to the server. in modern days this is done via an AJAX request.

Checkout Jquery ajax functions this would be the easiest way.

Solution 3:

You can't. You have to make a request to a PHP page, usually via AJAX, and then that page has to call the PHP function and return the results.

Post a Comment for "Button To Call A Php Function?"