PhysicianManagement.prototype.listPhysician =
function() {
alert(JSON.stringify(this.physicianList)); // {}
alert(JSON.stringify(this.physicianRelList)); // {}
};
PhysicianManagement.prototype.initProviderInfo =
function() {
ajaxCallForEventWithJsonData(this,'fetchProviderInformation',
null,
null,
function (that,data) {
that.physicianList =
data;
});
ajaxCallForEventWithJsonData(this,'fetchProviderRel',
null,
null,
function (that,data) {
that.physicianRelList =
data;
});
ajaxCallForEventWithJsonData(this,'fetchLoginUserInformation',
null,
null,
this.initLoginUserInformation); //由于异步,这里在数据还未请求结束就已经执行了
this.listPhysician();
};
解决办法
ajaxCallForEventWithJsonData(
this,'fetchProviderInformation',
null,
null,
function (that,data) {
that.physicianList =
data;
ajaxCallForEventWithJsonData(that,'fetchProviderRel',
null,
null,
function (innerThat,data) {
innerThat.physicianRelList =
data;
innerThat.listPhysician();
ajaxCallForEventWithJsonData(innerThat,'fetchLoginUserInformation',
null,
null, innerThat.initLoginUserInformation);
});
});
转载于:https://www.cnblogs.com/shouwangzhe-/p/3957904.html