reqwest icon indicating copy to clipboard operation
reqwest copied to clipboard

fail doesn't get fired when I get a 400 response with jsonp

Open triggertoo opened this issue 10 years ago • 1 comments

Hi, everything with jsonp works fine as long as there is no other status code than 200. When I get a 400, neither success nor fail is called.

reqwest({
            type: 'jsonp',
            method: 'get',
            url: config.api_base_url + '/' + encodeURIComponent(type),
            data: reqwestData,
            contentType: 'application/json',
            jsonpCallback: 'callback',
            jsonpCallbackName: 'cbhandler',
            fail: function () {
                displayResults([], 0, null, q, offset, limit, type);
            },
            success: function (body) {
                if (!(body.results instanceof Array)) {
                    body.results = [];
                }

                displayResults(body.results, body.total_hits, body.suggestion, q, offset, limit, type);
            }
        });

triggertoo avatar Feb 03 '15 18:02 triggertoo

same + 1

huarse avatar Jun 03 '16 02:06 huarse