Am trying to display success message when the user follow and unfollow…with the code below nothing is display to tell the user that he/she have successfully follow/unfollow…any help and if I have to add new element with the html that display the follow/unfollow button…
$(function() {
$(".follow").click(function(){
var element = $(this);
var user_id = element.attr("id");
var info = 'id=' + user_id;
$.ajax({
type: "POST",
url: "add_follow.php",
data: info,
success: function(){
$('#remove'+I).fadeIn(200).show();
}
});
return false;
});
});
$(function() {
$(".remove").click(function(){
var element = $(this);
var user_id = element.attr("id");
var info = 'id=' + user_id;
$.ajax({
type: "POST",
url: "remove.php",
data: info,
success: function(){
$('#remove'+I).fadeOut(200).hide();
}
});
return false;
});
});
{
//this display unfollow button
echo "<li id='remove$comID'><a href='#' class='remove' id='$comID' >Following</a></li>";
}
else {
// this display follow button
echo "<li id='follow$comID'><a href='' class='follow' id='$comID' >Follow company</a></li>";
}