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); }); });
时间: 2024-11-14 12:27:38