ajax response byte size

Posted by Alex Pacurar on Stack Overflow See other posts from Stack Overflow or by Alex Pacurar
Published on 2010-04-15T13:11:09Z Indexed on 2010/04/15 13:13 UTC
Read the original article Hit count: 334

Filed under:
|
|
|
|

Im using jQuery's getJSONP and I want to log the duration of the call and the size of the response to be able to have some statistics about the usage of my application. This is a cross domain ajax call, so I need to use JSONP, but as the JSONP call is not done with an XMLHttpRequest object, the complete callback from jquery's ajax doesnt pass the response content.

So my question is how to get the response size (content lenght) from a JSONP call.

$.ajaxSetup(
{
    complete:function(x,e)
    {
         log(x.responseText.length, x.responseText);
    }
}

here x is a XMLHttpRequest object for a JSON call , but for JSONP call is undefined.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery