在 Ajax 中失去范围调用成功



我正在用我的方法编写服务调用。一旦 ajax 调用被触发,我就会得到响应。但是在得到响应后,我在 ajax 成功中丢失了该方法的另一个变量,

这是我的代码。

refreshClick: function(options) {
let _this = this,
selectedrecord = this.getView().getStore().getAt(options.rowIndex);
let reqObj = {
url: options.url + selectedrecord.data.val,
method: 'get',
};
_this.getGridService().loadGridStoreData(reqObj).then({
success: function(response) {
debugger;
},
failure: function(response) {
Ext.Msg.alert('Failed', result);
_this.getView().getStore().load();
return false;
}
});
}

现在在调试器行中取得成功后,我没有得到optionsselectedRecs的值。

这可能是调试器从范围中删除未使用的变量,引用函数内的变量:

console.log(options,selectedRecs);
debugger;

您应该能够访问其值。

最新更新