【发布时间】:2013-04-25 13:24:44
【问题描述】:
假设我有以下:
var object = {
myfunc: function() {
$.ajax({
url: url,
format: format,
success: function() {
console.log(this) // This refers to the ajax call and not "object"
$.ajax({
url: url,
format: format,
success: function() {
console.log(this) // this refers to nested ajax call and not "object"
}
});
}
});
}
}
如何让“this”引用“object”而不是 ajax 调用?
【问题讨论】:
标签: javascript jquery