Javascript AJAX doubt

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
santya
Forum Newbie
Posts: 1
Joined: Sun Feb 06, 2011 3:14 am

Javascript AJAX doubt

Post 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
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Javascript AJAX doubt

Post by John Cartwright »

Why not just use the $.post success callback,

i.e.,

Code: Select all

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