$.get的重写
1 window.meng = window.meng || {}; 2 (function () { 3 4 function Get() { 5 this.def = $.Deferred(); 6 } 7 8 Get.prototype.request = function (url) { 9 $.get(url, function (data) { 10 this.def.resolve(data); 11 }.bind(this)); 12 return this.def; 13 }; 14 meng.Get = Get; 15 })();
网上的一篇好文章:http://www.ruanyifeng.com/blog/2011/08/a_detailed_explanation_of_jquery_deferred_object.html
myGitgub https://github.com/mfx55
希望我的博客能帮到你