0
我無法在我的頁面上觸發ajaxStop
。我在這裏錯過了明顯的東西嗎?ajaxStop沒有觸發
var photoArray = [];
var urls = [URL1, URL2] //these are proper URLS in the complete script
_.each(urls, function(url) {
$.ajax({
url: url,
dataType: 'jsonp',
error: function(x,y,z) {
console.log(x,y,z);
},
success: instagrab
});
});
$(document).ajaxStop(function() {
console.log("ajaxstop");
$(this).unbind('ajaxStop');
});
function instagrab(data) {
_.each(data.data, function(val){
var tagged = $.inArray(tag, val.tags);
if (tagged !== -1) {
photoArray.push(val);
}
});
}
我已加載了underscore.js。對不起,應該提到這一點。 ajax調用工作正常。問題是我沒有看到'console.log'語句。 – Nathan
你確定嗎? http://jsfiddle.net/TfhhX/(我不得不將下劃線更改爲'$')並且輸出看起來不錯。 – sachleen