jQuery $.ajax() functionality - Accessing the XMLHttpRequest object

jquery

Solution

You can use beforeSend callback too:

$.ajax({
    beforeSend: function(jqXHR, settings){
        // Here you are the XHR object
        console.log(settings.xhr());
    }
});

Problem

Is it possible to access the `XMLHttpRequest` object from the success callback of the `$.ajax()` function? Specifically I need access to `XMLHttpRequest.responseBody` in IE. Per the documentation the returned `jqXHR` object does not expose the `.responseBody` property. This seems to be a minor oversite that has a huge impact when dealing with binary data. If the `.responseBody` property or the underlying `XMLHttpRequest` object is not accessible I'll have to skip jQuery for ajax and code it in, shudder, pure javascript. Update I am infact looking for the `responceBody` variable, not the `responceText` variable that is readily accessible from within `$.ajax()`

Original source

Related problems