Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 在本地服务器上工作但不是实际服务器的延迟对象数组_Jquery_Backbone.js - Fatal编程技术网

Jquery 在本地服务器上工作但不是实际服务器的延迟对象数组

Jquery 在本地服务器上工作但不是实际服务器的延迟对象数组,jquery,backbone.js,Jquery,Backbone.js,我正在使用一个延迟对象数组,以便在主干模型集合在服务器上完成保存时显示和隐藏加载图标 这是我的代码: $('div.loading').show(); self.collection.each(function(item) { item.url = "/Foo/FooBar"; defs.push(item.save()); });

我正在使用一个延迟对象数组,以便在主干模型集合在服务器上完成保存时显示和隐藏加载图标

这是我的代码:

            $('div.loading').show();

            self.collection.each(function(item) {
                item.url = "/Foo/FooBar";
                defs.push(item.save());
            });

            // when everything is saved 
            $.when.apply(null, defs).then(function() {
                $('div.loading').text("Save Complete");
                $('div.loading').fadeOut(1500);
                self.render();
                alert("It's finished!");
            });
是否有任何一般原因导致警报从未被调用,而加载的gif仅停留在屏幕上


我通过浏览器检查了这些呼叫,它们都返回200状态,因此没有发生任何服务器端错误

将第二个函数添加到.then并记录参数,最有可能的是其中一个延迟参数被拒绝。
.then(function(){/*theoriginalfunction*/},function(){console.log(arguments)})如下:$.when.apply(null,defs).then(function(){},function(){console.log(defs);})
arguments
而不是
defs
它只说了[objectarguments],但我不能点击它。