Calling PHP Function within Javascript

前端 未结 5 1809
有刺的猬
有刺的猬 2020-12-11 19:22

I want to know is it possible to call a php function within javascript, only and only when a condition is true. For example



        
5条回答
  •  感动是毒
    2020-12-11 19:41

    The other answers have it right.

    However, there is a library, XAJAX, that helps simulate the act of calling a PHP function from JavaScript, using AJAX and a particularly designed PHP library.

    It's a little complicated, and it would be much easier to learn to use $.get and $.post in jQuery, since they are better designed and simpler, and once you get your head around how they work, you won't feel the need to call PHP from JavaScript directly.

提交回复
热议问题