user1375026
user1375026

Reputation: 413

EXT.Ajax.request going to success when JSON returns "success" : false

I have this EXT JS code:

Ext.Ajax.request({
                url     : "xxx",
                method  : "POST",
                params  : params,
                success : function(response) {
                            success();

                },
                failure : function(){
                            fail();
                }
        }); 

The url xxx returns this piece of JSON.

{"success": false }

For some reason this never goes into failure. It never runs the fail() method, always success(). What's going wrong?

Upvotes: 4

Views: 3362

Answers (1)

sha
sha

Reputation: 17850

It would call failure handler only when request would failed on the network level - if you get server error or server won't return anything. Otherwise it will be success and you need to parse response to see if it was logical failure.

Upvotes: 5

Related Questions