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

Posted by Dumpen on Stack Overflow See other posts from Stack Overflow or by Dumpen
Published on 2012-10-06T21:21:58Z Indexed on 2012/10/06 21:37 UTC
Read the original article Hit count: 196

Filed under:
|
|
|
|

So I am working on tool that can show long a request to a page is taking.

I am doing this by using jQuery Ajax (http://api.jquery.com/jQuery.ajax/) and I want to figure out the best way to get the response time.

I found a thread (http://forum.jquery.com/topic/jquery-get-time-of-ajax-post) which describes using the "Date" in JavaScript, but is this method really reliable?

An example of my code could be this below

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

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX