var COLLECTION = Backbone.Collection.extend({
url: "example.com",
sync: function(method, model, options){
params = _.extend({
type: "get",
url: this.url,
async: false,
dataType: "jsonp",
jsonpCallback : "jsonp_callback",
},options);
return $.ajax(params);
},
parse:function(response){
console.log(response);
return response;
}
});
var a = new COLLECTION();
var b = new COLLECTION();
$.when(a.fetch(),b.fetch()).done(function(){ console.log('done'); });
我有两个问题:</p>
- 在同步函数中,$.ajax(params) 响应
TypeError: a["reset"] is not a function
@0.9.10 - 使用多个 collection.fetch 有时会发生
a.fetch() or b.fetch() response parse error
谢谢!!