So here's my code for when a user clicks a follow button:
$('.follow_btn').click(function() {
$(this).html('<img src = "../assets/style_images/loading.gif">');
var userId = $(this).attr('id');
$.post('../assets/scripts/ajax_follow_parse.php', {
userId: userId
}, function(data) {
$(this).html(data);
});
});
It is quite happy to replace it with the loading gif as shown on line 2. But when it returns the data and replace it with the data returned on line 4.
How can I fix this?