Page 1 of 1

Javascript AJAX doubt

Posted: Sun Feb 06, 2011 3:28 am
by santya
Hey Champs,

I am currently stuck in this problem. I have executed a php script using jQuery API $.post, script executes properly, i am inserting a row in the database using this php script. Also i have written a callback function for post method. Now how can i call the javascript function to show a success message from this point ?

i have tried

echo "<script type='text/javascrip' >alert('success')</script>";

but that didn't work.
Please help me out,
Waiting for some positive responses.

-Santya

Re: Javascript AJAX doubt

Posted: Sun Feb 06, 2011 12:35 pm
by John Cartwright
Why not just use the $.post success callback,

i.e.,

Code: Select all

$.post('ajax/test.html', function(data) {
  alert('success');
});