I\'m 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.
you can get the "Content-Length" of the response header:
var contentsize;
$.ajax('url', function(data, textstatus, request) {
contentsize = request.getResponseHeader("Content-Length") / 1024;
//do stuff with your data
});
$.ajax('url',function(data,textstatus,request)
{
var totalBytes = request.getResponseHeader('Content-length');
//if u are looking for downloaded bytes
var dlBytes =request.responseText.length;
});