Good morning I have this jquery code
<script> $(document).ready(function(){ $(".like").click(function(){ var id = this.id; $.ajax({ url: "megusta.php", type: "POST", data: {id:id}, dataType: "json", success:function(data){ var likes = data["likes"]; var text = data["text"]; $("#likes_" + id).text(likes); $("#" + id).html(text); } }); }); }); </script>
I'm doing a facebook guy, so when I click on I like it changes to I do not like it anymore but when I click again to change to like it, that's when the problem comes, the click event is executed twice