0

My php code:

throw Exception("Lorem !", 403);

now I want by ajaxError, get Lorem ! :

$(document).on('ajaxError', function(el, jqxhr) {
  console.log(xhr.statusText);
  console.log(xhr.responseText);
});

that xhr.statusText give me Forbidden message, not Lorem !.
and xhr.responseText give all html code of 403 Page !
How can give Lorem ! text instead?

  • Depends on how your server handles exceptions, you are not giving details here. – dfsq Oct 05 '17 at 11:35
  • 1
    Look into [this](https://stackoverflow.com/questions/12693423/clean-way-to-throw-php-exception-through-jquery-ajax-and-json) – Starx Oct 05 '17 at 11:36

0 Answers0