javascript - Post back variable from PHP to JS after POST? -


is possible post php file js php , results external php file js file posted information? don't it's success - want what's echoed actual content php file processes it.

here's code have:

$(function() { $(".deletebutton").click(function() {  $.ajax({   type: "post",   url: "*****/process_delete.php",   data: datastring,   success: function() {       // results form here   }  }); return false; }); }); 

haven't found anywhere possible, it? if so, please post example code!

thanks!
coulton

the success function receives data server returned first parameter

$.ajax({   type: "post",   url: "*****/process_delete.php",   data: datastring,   success: function(data) {       // data here   }  }); 

you can use datatype attribute of $.ajax object ensure data in format expect. if process_delete.php returning json, example:

$.ajax({   type: "post",   url: "*****/process_delete.php",   data: datastring,   success: function(data) {       // data here   },   datatype: "json" // data string returned javascript object.  }); 

Comments