How can I call PHP functions by JavaScript?

后端 未结 11 1372
情话喂你
情话喂你 2020-11-22 12:08

I am trying to call a PHP function from an external PHP file into a JavaScript script. My code is different and large, so I am writing a sample code here.

This is m

11条回答
  •  孤城傲影
    2020-11-22 12:50

    If you actually want to send data to a php script for example you can do this:

    The php:

    
    

    Js (using jquery):

    $.post("/path/to/above.php", {a: something, b: something}, function(data){                                          
      $('#somediv').html(data);
    });
    

提交回复
热议问题