Call A Javascript Function After Ajax Success
I am using the below test code to call a javascript function from ajax method after the success block and pass the success value to a javascript funtion.It's working fine. Now i wa
Solution 1:
Add a callback to your testAjax
function
functiontestAjax() {
$.ajax({
url:"getvalue.php",
success:function(data) {
var retval= change_format(data);
alert(retvl);//always return nullarguments[0](retvl);
// I can't get the result
}
});
}
functionchange_format(a) {
// do everything here
}
testAjax(change_format);
Solution 2:
The $.ajax sucks. Why not just use the load(). Simple but very powerful. Deploy the algorithm in the code below:
<divid="stage">RESULT SHOWS HERE</div><buttonid="clickMe">Click Me</button><script>
$(document).ready(function() {
$("#clickMe").click(function() {
$("#stage").load("URL?PARAMETERS");
});
});
</script>
Post a Comment for "Call A Javascript Function After Ajax Success"