当前位置 : 主页 > 网络推广 > seo >

Extjs4.1,在存储同步后检索响应消息

来源:互联网 收集:自由互联 发布时间:2021-06-16
如何在失败功能中检索响应消息? store.sync({ success : function(){}, failure : function(response, options){ console.log(response.responseText); //it does not work, because there is responseText attr in response } }); 响应文本
如何在失败功能中检索响应消息?

store.sync({
 success : function(){},
 failure : function(response, options){
   console.log(response.responseText); //it does not work, because there is responseText attr in response
 }  
});

响应文本是这样的,

{"success":false,"message":"Test Error"}

有人知道,请指教.

谢谢

[编辑]

console.log(response);

然后,

我不确定你是否想过这个,但上面的建议我很确定是错的.您需要查看商店代理的请求异常.

以下是在执行商店同步之前要调用的一些代码.

Ext.Ajax.on('requestexception', function (conn, response, options) {

  if (response.status != 200) {
    var errorData = Ext.JSON.decode(response.responseText);
    Ext.Msg.alert('Creating User Failed',errorData.message);
  }

});

很抱歉挖掘这个旧帖子,但是因为我刚刚经历了同样的斗争,所以看到上面的答案很痛苦.

HTH的.

网友评论