reqwest
reqwest copied to clipboard
fail doesn't get fired when I get a 400 response with jsonp
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);
}
});
same + 1