我有一個店:ExtJS的3.4回調函數
var store = new Ext.data.JsonStore({
root: 'list',
url: '../myProject/getData.ajax',
baseParams:{
date:'',
},
fields: rec,
totalProperty:'totalCount',
pruneModifiedRecords:true,
autoLoad : false,
listeners:{
load:function(){
globalMask.hide();
}
}
});
而且鍵後按我加載存儲與功能:
function storeLoad(){
store.baseParams = {
date:date.getRawValue(),
},
store.load({
params :{start:0, limit:100},
callback: function (response,options,success) {
if (success){
var res = Ext.util.JSON.decode(response.responseText);
if(res.msj != null){
Ext.MessageBox.alert("Sonuç",res.msj);
}
} else{
Ext.MessageBox.alert("Error","Error message : "+response.statusText+". Try again later!!! ");
}
console.log("response:"+response);
console.log("op:"+options);
console.log("success:"+success);
console.log("res:"+res);
console.log("res.mesaj:"+res.msj);
}
});
}
並在此之後在控制檯的回報是這樣的:
響應:[對象對象],[對象對象],[對象對象],[對象 對象],[對象對象],[對象對象],[對象對象ect],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] [Object Object] ,[對象對象],[對象對象],[對象對象],[對象 對象],[對象對象],[對象對象],[對象對象],[對象 對象],[對象對象]對象],[對象對象],[對象 對象],[對象對象],[對象對象],[對象對象],[對象 對象],[對象對象],[對象對象],[對象對象] [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object 對象],[對象對象],[對象對象],[對象對象],[對象 對象],[對象對象],[對象對象],[對象對象],[對象 對象],[ ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object對象],[對象 對象],[對象對象],[對象對象],[對象對象],[對象 對象],[對象對象],[對象對象],[對象對象],[對象 對象] ,[對象對象],[對象對象],[對象對象],[對象 對象],[對象對象],[對象對象],[對象對象],[對象 對象],[對象對象]對象],[對象對象],[對象 對象],[對象對象],[對象對象ect],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] [對象 對象]
運算:[對象的對象]
成功:真
RES:
res.msj:未定義
我怎樣才能手這個?爲什麼無法解碼響應?我想在成功後加載商店,但商店加載本身。如何使用Callback成功和失敗? 存儲根是真實的,它加載但成功或失敗後無法加載它?
從服務器獲得的實際JSON響應是什麼? – Scriptable 2015-04-06 13:07:08
帶有'list'鍵的json數組。 [「list」:[all data],「success」:true/false,「totalCount」:110,「msj」:「完成/錯誤」] – ROOT 2015-04-06 13:25:51
嘗試通過http://jsonlint.com運行您的JSON resposne/ – Scriptable 2015-04-06 13:53:37