我在 AJAX 调用返回时错过了这个。我有
interar.js
interar.Remoter = function (data) {
this.server = data.server;
this.init(data);
};
interar.Remoter.prototype.init = function (data) {
var succeedCB, errorCB, lPayload, promiseCB;
succeedCB = function (result) {
// When return the called the this is === window not in.
this.uuid = result.uuid;
console.log("UUID v4 From Server " + this.uuid);
};
errorCB = function () {
console.error("Not Allow to Connect to Server ");
}
// This execute a XHTTPRequest Async call
interar.execute(succeedCB, errorCB, {'w' : data});
};
索引.html
var W = new interar.Remoter("mydata");
在succeedCB返回时,this is window not interar instance