Search code examples
jqueryfirebuggoogle-chrome-devtoolsjquery-load

jQuery .load() - measure the time


I'm using jquery .load() to load some external(but within same domain) resourses into the page.

As this action is not visible through FireBug Network / Chrome Network console - how can I measure the time of loading?


EDIT:

If running locally ( not localhost ) FireBug will not record this action.

Make sure you are testing this using WAMP / XAMPP (localhost) or on an on-line server.


Solution

  • Using difference in time:

    var startDate = new Date();
    var startMilliseconds = startDate.getTime();
    
    $('mycontainerselector').load('myurl.html', function() {
        console.log(new Date().getTime() - startMilliseconds);
    });
    

    some corrections may be needed :)