【发布时间】:2012-09-27 15:45:42
【问题描述】:
所以我正在开发一种工具,可以显示对页面的请求所花费的时间。
我通过使用 jQuery Ajax (http://api.jquery.com/jQuery.ajax/) 来执行此操作,我想找出获得响应时间的最佳方法。
我找到了一个线程 (http://forum.jquery.com/topic/jquery-get-time-of-ajax-post) 描述了在 JavaScript 中使用“日期”,但是这种方法真的可靠吗?
下面是我的代码示例
$.ajax({
type: "POST",
url: "some.php",
}).done(function () {
// Here I want to get the how long it took to load some.php and use it further
});
【问题讨论】:
-
为什么我们不能在开发工具 goto 网络中使用 chrome 开发工具 -> XHR 你可以看到所有请求的大小和时间
标签: jquery ajax time request response