0
我想聲明一個全局變量,該變量從DataStore獲取值並在其警報窗口中顯示其值。來自JSON DataStore的全局變量
var params = 1;
var storeTeacher = new Ext.data.JsonStore({
id: 'IDstoreTeacher',
url: 'school.php',
method: 'POST',
baseParams:{task: "LABEL",
parametar: params},
root: 'rows',
fields:
[{name: 'NameT', type: 'string', mapping: 'Teacher_name'}],
autoLoad: true
});
var TeacherName;
storeTeacher.load({
scope: this,
callback: function (records, operation, success) {
TeacherName = storeTeacher.getAt(0).get('NameT');
}
});
alert(TeacherName);
但是,只有我拿到的就是警告窗口,上面寫着:正在執行正在回調之前,您storeTeacher.load
回調執行您的通話alert(TeacherName);
未定義
謝謝。現在一切正常 – Goran 2012-07-16 13:09:49