0

「レコードが見つかりません」という応答に対するJSON応答を次に示します。「エラーメッセージ」または「応答」を確認しようとすると、適切に機能していません。

{
"showItems" : 
   [
    {
     "errorMsg" : "NoRecordsFound",
     "response" : "failed"
    }
   ]
}  

コンディションチェック

 success: function (response) 
 {
  var respObj = Ext.JSON.decode(response.responseText);
  alert(respObj[0].response);//here it does not retutning anyting
  if(respObj[0].response=="Success")
    {
      Ext.getCmp('itemList').setData(respObj.showItems);
    }
  if(respObj[0].response=="failed")
    {
      Ext.Msg.alert("Alert!","No records found!");
    }
 }

状態を確認するにはどうすればよいですか?これを解決するのを手伝ってください

4

1 に答える 1

1
Ext.JSON.decode(response.responseText) will return

ここに画像の説明を入力

このような応答にアクセスする必要があります

respObj.showItems[0].response

どこ

respObj はオブジェクトです

showItems は配列です

response & errorMsg は、showItems 配列の最初のアイテムのプロパティです。

試す

success: function (response) 
 {
  var respObj = Ext.JSON.decode(response.responseText);
  var response=  respObj.showItems[0].response;
  alert(response);
  if(response=="Success")
    {
      Ext.getCmp('itemList').setData(respObj.showItems);
    }
  if(response=="failed")
    {
      Ext.Msg.alert("Alert!","No records found!");
    }
 }
于 2013-09-30T06:16:05.320 に答える