您正在寻找方法的
context参数
ajax。
它允许您设置将在其中调用所有回调的上下文。
function Cat() { this.meow = function() { // meow }; $.ajax({ context: this, success: function() { this.meow(); } }); }
您正在寻找方法的
context参数
ajax。
function Cat() { this.meow = function() { // meow }; $.ajax({ context: this, success: function() { this.meow(); } }); }