ajaxStop没有开火

时间:2012-06-12 21:44:10

标签: jquery ajax

我无法在我的网页上触发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);
        }
    });
}

1 个答案:

答案 0 :(得分:0)

应该是$.each。你有一个下划线。