简体   繁体   English

Sencha touch:使用HTTP状态代码而不是{“success”:true}

[英]Sencha touch: Use HTTP status codes instead of {“success”:true}

I'm building a restful Sencha Touch app backed by a rails app and am having a little trouble getting them to play nice. 我正在构建一个由rails应用程序支持的宁静的Sencha Touch应用程序,并且让他们玩得很好有点麻烦。

Sencha seems to be ignoring HTTP status codes, and instead is dependent of the response having a "success" property set to true in order for it to consider the request successful. Sencha似乎忽略了HTTP状态代码,而是依赖于将“success”属性设置为true的响应,以便它认为请求成功。

Is there any way to override sencha to use HTTP status codes instead of the "success" property? 有没有办法覆盖sencha使用HTTP状态代码而不是“成功”属性?

Do you have some code as an example? 你有一些代码作为例子吗? If you use a raw Ext.Ajax request you can give it a callback function that will be called no matter what happens with the request. 如果你使用原始的Ext.Ajax请求,你可以给它一个回调函数,无论请求发生什么,都会调用它。 That should be bare metal enough for anything. 对于任何事情来说,这应该是裸金属。 http://docs.sencha.com/ext-js/4-0/#!/api/Ext.Ajax-method-request http://docs.sencha.com/ext-js/4-0/#!/api/Ext.Ajax-method-request

Let me give you some advice though and try not to fight the Ext API too much. 让我给你一些建议,尽量不要过多地对抗Ext API。 It will really make your life more difficult in the long run. 从长远来看,这将使你的生活更加困难。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM