如何从Store.sync()上的服务器获取响应消息 [英] How to get response message from server on Store.sync()

查看:57
本文介绍了如何从Store.sync()上的服务器获取响应消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一家想与服务器进行 sync()的商店.

I have a store which I'd like to sync() with server.

Store.sync()方法具有成功 failure 属性功能,它们具有 Ext.data.Batch options 作为参数.

Store.sync() method have success and failure property-functions, they have Ext.data.Batch and options as parameters.

如果我从服务器收到这样的答复:

If I get such response from server:

{
  success: false,
  msg: "test error!"
}

失败方法被调用.

如何从 failure 方法中访问响应 msg 属性?

How to access response msg property from within failure method?

推荐答案

    store.sync({
        failure: function(batch, options) {
            alert(batch.proxy.getReader().jsonData.msg);
        }
    });

这篇关于如何从Store.sync()上的服务器获取响应消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆