0
內我有一個對象,我有一個Ajax請求:停止Ajax調用對象
var newsrecentObj = {
init: function() {
var self = this;
self.fetch().done(function(data) {
console.dir(data);
}).error(function(data) {
// stop ajax call
});
},
fetch: function() {
var self = this;
return $.ajax({
url: 'http://url.to/api',
timeout: 5000,
dataType: 'jsonp'
});
}
}
var newsrecent = Object.create();
newsrecent.init();
我想,當發生超時停止請求。但我該怎麼做?
Tnx