I'm trying to display response of PHP script within a div element <div id="divname"></div>
jQuery('#divname').load('TEST.php',{
'id' : id
});
My code works as expected and successfully insert «1» inside this div.
TEST.php file:
<?php
echo '1';
?>
...but I would also like to alert the response in the same time using jQuery, someting like this:
jQuery('#divname').load('TEST.php',{
'id' : id
},
alert(response); //????
);
Can You help me?
$.getwith a callback or$.ajax.$.getor$.ajax, than you can also check if the action executed, failed, succeeded, and more. See the documentation: api.jquery.com/jquery.ajax