How to run php script from jQuery - on button click
Walshie1987. The question was asked: Apr 15, 2020. 01:26
1 answer
I have a simple PHP script that sits in the home directory of my webserver. I also have a button called "campausebtn". I want to simply click the button and then call the php file using jquery. I've read many posts on SO and it seems simple, but I can't get it to work.
I've tried the following script:
<script> jQuery(document).ready(function(){ jQuery("#campausebtn").click(function(){ alert("Paused Clicked!"); $.ajax({ url: 'camera_pause.php', success: function() { alert("Paused!"); } }); }); }); </script>
The "Paused Click" alert is working fine, so I know the jQuery and button are working. It just wond't run the script.
Please can someone help?
Thanks Chris