I have a code that calls execution of a remote code. Upon successful completion, I need to save the total time it took (the same time value that is shown in chrome developers console). The part of my ajax call is:
function callJSON(){
$.ajax({
type: 'POST',
url: 'http://x.php',
crossDomain: true,
data: {matrix:input1[array]},
dataType: 'text',
success: function(res, textStatus, jqXHR)
{
console.log(jqXHR.status);
},
error: function (res1, textStatus, errorThrown) {alert('POST failed.');
}
});//AJAX
}//CALLjsonone
the code works fine and everything is okay. I am able to get the status using console.log(jqXHR.status) code. But, I am looking for a command to get the time or size fields shown in chrome developer console. It should probably be like console.log(jqXHR.X.time); that X is what I need.
You could create a timer, something like this:
right before your ajax call, then after the call, in your success method;
and at last: