mam taki kod

  1. function callApi(acallback) {
  2. // alert(acallback);
  3. $.ajax({
  4. url: acallback,
  5. type: 'GET',
  6. dataType: "jsonp",
  7. jsonp: "callback",
  8. jsonpCallback: "jsonpCallback2",
  9. complete: function (response, responseCode) {
  10. console.log(response); console.log(responseCode);
  11. },
  12. success: function (json) {
  13. console.log(json);
  14. var HotelName = "jakasnazwa";
  15. ;
  16. $.each(json, function (index, value) {
  17. var contentFromAPI = '<tr><td>' + this.ReservationId + '</td><td>' + HotelName + '</td><td>' + this.CheckInDate + '</td><td>' + this.Total + '</td><td>' + this.CreatedOn + '</td><td>' + this.Status + '</td></tr>';
  18. // alert(contentFromAPI);
  19. $("table.arrival tbody").append(contentFromAPI);
  20. });
  21.  
  22. },
  23. error: function(response, status, err){
  24.  
  25. console.log(response.status);
  26.  
  27. if(response.status == 400){
  28. console.log("Sorry, this is bad request!");
  29. }
  30. if(response.status == 601){
  31. sessionTimedOut();
  32. }


Tylko, ze gdy dostaje error 400
  1. "NetworkError: 400 Bad Request


W konsoli nie ma mojego Sorry, 'this is bad request!'
Jak to ugryźc?

EDIT:
Response body
  1. {
  2. "reason": "date(s) are invalid",
  3. "code": 400
  4. }


Wiem, ze moge poprostu sprawdzic czy code ==400, ale czy nie da sie tego zalatwic poprzez error?