I've this:
$(".follow").click(function() {
var element = $(this);
var id = element.attr("id");
var data = "id=" + id;
$.ajax({
type: "POST",
url: "follow.php",
data: data,
success: function(result) {
element.removeClass("follow");
element.addClass("unfollow");
}
});
return false;
});
$(".unfollow").click(function() {
alert("Hey, dude");
});
When I click on my button I can see with Firebug the class switch. But if I try to click the button again, it doesn't appear the alert, the script send always the POST request to follow.php.
Why?