一般來說 Backbone 在針對 model 送 ajax 到後端時使用方法如下:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Backbone.Model.fetch({ | |
success: function(model, response) { | |
console.log('model = ', model); | |
}, | |
error: function() { | |
console.log('error'); | |
} | |
}); |
但在 IE 會針對相同的 ajax request 做 cache,所以必須將 ajax 的 cache 設定為 false,在 backbone 必須要這樣設定:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Backbone.Model.fetch({ | |
cache: false, | |
success: function(model, response) { | |
console.log('model = ', model); | |
}, | |
error: function() { | |
console.log('error'); | |
} | |
}); |
相關連結
http://stackoverflow.com/questions/6178366/backbone-js-fetch-results-cached
沒有留言:
張貼留言