我正在尝试将 ajaxStart 和 ajaxStop 事件与 getJson 调用一起使用到我的网络服务器。ajaxStart 事件在第一个请求时触发,但不会在后续请求中触发。encID 确保每个请求的 url 在某种程度上是唯一的。它不适用于 Firefox 3.5 或 IE 7。在 firebug 中,我可以看到 getJSON 请求正在触发并完成。有任何想法吗?
这是我的 ajax 事件绑定。
$('#ajaxLoader').ajaxStart(function(){
$(this).show();
}).ajaxStop(function(){
$(this).hide();
});
这是我的 getJSON 调用。
$.getJSON(location.protocol + '//' + location.host + '/enc-comment/get?format=json&c=?' + '&encId=' + encId,
function(data){
// change text of a div
});
如果我用 .ajax GET 或 POST 切换 getJSON 调用,一切正常。