0
I have a request made by Jqueryfiledownload that when error occurs the server returns different types of status. I need to act on the client according to these errors. Other than jquery ajax I can’t get by fileDownload receive the current status of the request. I would like to know if there is any way via javascript get this status. Remembering that the call will continue to be made by fileDownload.
$.fileDownload(url)
.done(function () {
jSuccess("com sucesso!", "Sucesso");
})
.fail(function () {
var erro = //quero pegar o status aqui
});
Check the parameters passed in
fail
. Doconsole.log(arguments)
to see if you have the argument with the code there.– Wallace Maxters
fail has two parameters: xhr, url... xhr returns an html and url the same url as requisica.
– Henrique Malveira
Try
xhr.status
. See: http://stackoverflow.com/questions/5344145/how-to-get-response-status-code-from-jquery-ajax– Wallace Maxters
sorry is not a xhr but a responseHtml
– Henrique Malveira