Wednesday, 18 September 2013

Call a javascript function after ajax success

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 want to get javascript return message
from ajax call. It always return null.
function testAjax() {
$.ajax({
url:"getvalue.php",
success:function(data) {
var retval= change_format(data);
alert(retvl);//always return null
I can't get the result
}
});
}
function change_format(data)
{
do something.....
value = "Some Data"; having some data
return value;
}

No comments:

Post a Comment