N
N
Neuro2019-08-05 16:11:51
JavaScript
Neuro, 2019-08-05 16:11:51

After successful ajax request trigger .fail?

Good afternoon, there is a put request to the server of this type:

const params = {
      url,
      method: 'PUT',
      contentType: 'application/json'
    };

    return $.ajax(params)
      .done(() => {
        
      })
      .fail((error) => {
        
      });
  }


The code is successfully executed and saves the sent data on the server, the server responds with OK 200, but then ajax does not run done, but .fail, what could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Arushanov, 2019-08-05
@Riveran

fail must take 3 arguments
xhr, status, error. You can add them to the options and what comes in them.
Maybe the text of the error will help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question