<form class="follow-form" method="post" action="listen.php">
<input name="followID" value="123456" type="hidden">
<button type="submit" value="Actions" class="btn follow" title="123456">
<i></i><span>follow</span>
</button>
</form>
javascript file:
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>');
});
});
});
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 user
thanks i have been up all night