How do I get the response time from a jQuery ajax call? [duplicate] How do I get the response time from a jQuery ajax call? [duplicate] ajax ajax

How do I get the response time from a jQuery ajax call? [duplicate]


The most simple method would be to add var ajaxTime= new Date().getTime(); before the Ajax call and in the done get the current time to calculate how long the Ajax call took to make.

var ajaxTime= new Date().getTime();$.ajax({    type: "POST",    url: "some.php",}).done(function () {    var totalTime = new Date().getTime()-ajaxTime;    // Here I want to get the how long it took to load some.php and use it further});

Or in case of you want to know how long time this take on the server side.Do the same and print the time in the return value from some.php.