I was curious if there was a way to hit the current xhr object in the success callback. I've been tinkering with it, and have been unable to figure out how to do that.
The reason I ask is because I am trying to debug an application I've been working on, and sometimes the response XML is not formatted correctly; however, the occurrence seems random, and still triggers the "success" method, since there are no actual server-side errors. I'm looking to do something like: var data = $.param(myObj); // post data // AJAX to val page $.ajax({ "type": "POST", "url": "myval.asp", "data": data, "dataType": "xml", "async": true, "global": false, "cache": false, "success": function (objXml) { $(objXml).find("ticket").exists( // see if the ticket is present function () { var ticket = this.attr("number"); if (typeof(ticket) === "undefined") { errorProcess({ "fn": fnName, "detail": "Ticket is present, but value is null", "page": "myval.asp", "post": data, "responseText": xhr.responseText // need tp hit XHR object here }) } // do stuff } ).absent( function () { errorProcess({ "fn": fnName, "detail": "Ticket is not present in response", "page": "myval.asp", "post": data, "responseText": xhr.responseText // need to hit the XHR object here }); } ); }, "error": functon (xhr) { errorProcess({ "fn": fnName, "detail": "Specifics on what's supposed to happen", "page": "myval.asp", // page I'm trying to AJAX to "post": data, "responseText": xhr.responseText }); } }); $(selector).exists() and $(selector).absent() are functions I added. Basically, if the selector is found in the DOM, the callback in exists is executed, if it's not found in the DOM, the callback in absent is executed. I'm needing to hit the XHR object's responseText property inside the success function of the AJAX call, but am not able to do so. Any ideas?