[jQuery] Ajax problem on Safari/Chrome browsers
Any suggestions, why this code is not working on Webkit browsers:
(function($) {
$.fn.followUser = function(userId) {
this.fadeOut(250);
$.get("profile.php", { do: "addfriend", id: userId }, function(data)
{
return this.html('Follower added
').fadeIn(250);
});
}
})(jQuery);
Only jquery and the plugin printed above are loaded, so there
shouldn't be any conflicts.
HTML:
<div id="followButton2">
<a onclick="$('#followButton2').followUser('2')">test1</a>
</div>
Chrome gives the following error:
Uncaught TypeError: Object #<an Object> has no method 'followUser