weixin_33686714 2016-05-10 12:29 采纳率: 0%
浏览 12

处理时间ajax

In Ajax is possible to calculate the processing time of the request? For example, if the extraction of data takes less than 3 seconds, to display a message and to enroll in logs by ajax. If possible you show me an example. P.S. Sorry for my bad english

  • 写回答

2条回答 默认 最新

  • 胖鸭 2016-05-10 12:35
    关注

    To get response time you can try something like this but as per this example you have to use jQuery.

    var starttime = new Date().getTime();
    
    jQuery.get('your-url-goes-here', data, 
        function(data, status, xhr) {
            var requesttime = new Date().getTime() - starttime;
        }
    );
    
    评论

报告相同问题?