Executing a php script in javascript?

后端 未结 3 2077
南旧
南旧 2021-01-17 05:23

I\'m trying to run a quick php script when users leave my website, and also pass a variable from my javascript to php but i\'m not quite sure how to include the php file and

3条回答
  •  时光说笑
    2021-01-17 05:56

    You need to make an AJAX call to the PHP script. Your javascript code will just make a background request to the php script which will execute those MySQL statements. Google up AJAX. Recommended: Learn jQuery and use ajax using $.get() or $.post()

提交回复
热议问题