Please, I want to use stopwatch to get the seconds from the time of sending of request through ajax and success function.
Asked
Active
Viewed 104 times
-1
-
Show what you have tried – AVI Dec 17 '15 at 13:30
-
1see the network tab. – Jai Dec 17 '15 at 13:31
1 Answers
0
You can do it like this:
var start_time = new Date();
$.ajax({
// Other params
success: function () {
var end_time = new Date();
alert("Time taken: " seconds(end_time) - seconds(start_time));
}
});
function seconds(date_obj) {
return date_obj.getTime();
}
Please figure out seconds()
yourself.

Praveen Kumar Purushothaman
- 164,888
- 24
- 203
- 252
-
I want to get the result in form of milliseconds – Prince Esanju Festus Babatunde Dec 17 '15 at 14:42
-
@PrinceEsanjuFestusBabatunde Can't you convert it yourself? The answer already gives in milliseconds only. Did you even try? – Praveen Kumar Purushothaman Dec 17 '15 at 14:55