如何从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);
}
});