Get status code of current request

Asked

Viewed 720 times

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. Do console.log(arguments) to see if you have the argument with the code there.

  • fail has two parameters: xhr, url... xhr returns an html and url the same url as requisica.

  • 1

    Try xhr.status. See: http://stackoverflow.com/questions/5344145/how-to-get-response-status-code-from-jquery-ajax

  • sorry is not a xhr but a responseHtml

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.