您可以定义一个变量存储
this在闭包中:
myGet: function (){ var _this = this; $.get("http://example.iana.org/",function(data){ _this.myMethod(); });}或使用$ .proxy:
myGet: function (){ $.get("http://example.iana.org/", $.proxy(function(data){ this.myMethod(); }, this));}或者,如果您不做任何事情,只需要调用
myMethod回调:
myGet: function (){ $.get("http://example.iana.org/", $.proxy(this.myMethod, this));}在现代浏览器中,您也可以使用bind。当我不必与IE8兼容时,我可以
myGet: function (){ $.get("http://example.iana.org/", this.myMethod.bind(this));}


