Radek Radek - 9 months ago 49
Javascript Question

measure processing time of AJAX call

I want to measure how long it takes to process AJAX call. I have it up and running but don't know how to code this in javascript (js only)

Answer Source
var start = new Date().getTime();
doAjax({
  success: function() {
    var end = new Date().getTime();
    console.log('milliseconds passed', end - start);
  }
});

save a time value before you start doing ajax stuff, and then do it again when it finishes. Then subtract one form the other and get your time.