This question already has answers here:
</div> </div> <div class="grid--cell mb0 mt4"> <a href="/questions/1637019/how-to-get-the-jquery-ajax-error-response-text" dir="ltr">How to get the jQuery $.ajax error response text?</a> <span class="question-originals-answer-count"> (11 answers) </span> </div> <div class="grid--cell mb0 mt4"> <a href="/questions/2833951/how-do-i-catch-an-ajax-query-post-error" dir="ltr">How do I catch an Ajax query post error?</a> <span class="question-originals-answer-count"> (7 answers) </span> </div> <div class="grid--cell mb0 mt8">Closed <span title="2019-08-09 09:40:55Z" class="relativetime">9 months ago</span>.</div> </div> </aside>
From my backend I wrote a POST api which returns a 403 error if a condition occurs. Together with the 403 error I am also passing a JSON response. In my front end I am using an AJAX request, however I can't seem to be able to read the JSON response when this error occurs. Are there ways to handle/capture the error and then read the JSON response as well ?
I was going to use the .then method however an error still props up without returning the JSON response.