1

I'm using jquery 3.3.1 and jqueryui 1.12.1

In a simplified version of my code I have this, which seems to be very similar to the idiom in answers to this question

 var deferred = $.ajax({
        "url" : url,
        "type": 'GET',
        "data": parameters
    });

 deferred.fail( function(jqXHR, textStatus, errorThrown) {
          console.log(jqXHR.responseText);
    });

However the parameters received by my fail function don't have the expected content.

The first parameter I receive has no responseText, and in fact seems to be a deferred object. The textStatus has a simple String: "error" and errorThrow an empty string: ""

Obviously in my real code I have a done() method as well, and that works just fine.

I'm running in Chrome if that is relevant. I would really like to have some better error reporting.

djna
  • 54,992
  • 14
  • 74
  • 117
  • you must to send form back-end and get in success – Wara Haii Jan 25 '19 at 11:12
  • @Wara Hall, I don't think this is right. You are referring to the long-standing way of using $.ajax that exploits success() and error() callbacks, for error handling in that case we would use the error() callback. There is a new style that exploits Deferred and Promises - the $.ajax() call returns a deferred object. I want to use this newer style; it has advantages for more complex scenarios. I am asking about error handling in this newer style. – djna Jan 25 '19 at 16:31

0 Answers0