[jQuery] Dblclick ajax loader repeats on all previously clicked elements
When a user double clicks on an element on my site an AJAX call is
made. During the AJAX call I have a loading gif in the space they
clicked on. For some reason, whenever another element is double
clicked all the elements that have been previously double clicked on
also show the loading gif again. Can anyone tell me how to stop this
happening?
Code:
$(document).ready(function() {
$('a.flagged').dblclick(function() {
var elId = $(this).attr('id');
var myId = elId.substr(8);
$(this).ajaxStart(function() {
$(this).html('<img src="/img/admin_graphics/loadingSmall.gif"
class="flaggedLoading" alt="..." />');
});
$(this).ajaxStop(function() {
$(this).remove('flaggedLoading');
});
$(this).load("URL" + myId);
});
});