jquery ajax problem?

aogokmoy

New Member
\[code\] <form class="follow-form" method="post" action="listen.php"> <input name="followID" value="http://stackoverflow.com/questions/3673600/123456" type="hidden"> <button type="submit" value="http://stackoverflow.com/questions/3673600/Actions" class="btn follow" title="123456"> <i></i><span>follow</span> </button></form>\[/code\]javascript file:\[code\]jQuery(function ($) { /* fetch elements and stop form event */ $("form.follow-form").submit(function (e) { /* stop event */ e.preventDefault(); /* "on request" */ $(this).find('i').addClass('active'); /* send ajax request */ $.post('listen.php', { followID: $(this).find('input').val() }, function () { /* find and hide button, create element */ $(e.currentTarget) .find('button').hide() .after('<span class="following"><span></span>Following!</span>'); }); }); });\[/code\]i wanted to know what kind of process would go in the listen.php via ajax, i know its a mysql statement, but then what after!! what it deos is : when you click the follow button, this sends the ajax request to listen.php and then if successfull it transfroms into following, showing that you followed the userthanks i have been up all night
 
Back
Top