ajax接口中的回调函数耗时怎么计算的


#1

你们是用什么方案计算的


#2

您好,我们会记录请求前和请求后的时间,两者之间做减法计算出请求耗时。


#3

这是请求耗时吧 ,而不是ajax回调函数的耗时吧


#4

普通的计算方式是如下这样
$.ajax({
success: function(){
var s = (new Date).getTime();
//
…response code
//
console.log( (new Date).getTime() - s)
}
})

如果不注入代码的该怎么计算这个时间