ajaxStart only called once
- by cmroanirgo
I'm having trouble with ajaxStart/ajaxStop. In the following code, the ajaxStart/ajaxStop code is only ever called once (the very first time). Any ideas why?
var A_func = function() {
$.get($(this).attr("href"), function(response) {
$("#content_inner").replaceWith($("#content_inner", response));
});
return false;
};
$(function() {
$("A").live("click", A_func);
$(document).ajaxStart(function(){$("#loading").show();alert("loading");});
$(document).ajaxStop(function(){$("#loading").hide();alert("finished");});
});
Note that the ajax requests themselves work correctly, it's just that the 'loading' icon only shows the once and then never again.
My html is something like:
<body>
<img id="loading" width="12" height="12" src="/images/ajax-loader.gif" style="display:none" alt="loading"/>
...
<div id="content"><div id="content_inner"...</div></div>...
</body>
I have also tried using ajaxSend/ajaxComplete and it has the same problem