开发者

Button to call a php function?

开发者 https://www.devze.com 2022-12-18 01:03 出处:网络
I am new to javascript wo开发者_运维知识库rld. I wrote a function in PHP. How do I call it when I click a button or image in html?If you want to call serverside functions you should use AJAX.

I am new to javascript wo开发者_运维知识库rld.

I wrote a function in PHP. How do I call it when I click a button or image in html?


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

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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消