javascript - How to run PHP script in the back by a jquery button -
i need run php code file when click button jquery. code have:
$(document).ready(function(){ $("#btnsubmit").button().click(function(){ alert("button 1"); $.ajax({ url: 'releasebackend.php', type: 'post', async: false, data: {}, datatype: 'xml', error: function(){ alert('error'); }, success: function(data){ //check error alert("success!"); } }); }); });
it shows alert of "error". have releasebackend.php file in same directory of javascript file.
change
$("#btnsubmit").button().click(
to
$("#btnsubmit").click(
and check whether php page sending response or not.
try getting error in error callback function using xmlhttprequest.
error(xmlhttprequest, textstatus) { }
Comments
Post a Comment