我想使用jQuery如何以正確的方式提醒使用jQuery的時間過程?
我的PHP代碼示例來說明我的PHP代碼的過程的時間:
<?php
//some queries to database
?>
這裏是我的jQuery:
$.ajax({
type: "POST",
url: "action.php",
data: {
action: "simpanFitur", fitur: $('#feature :selected').val()
},
success: function(){
var stop = new Date().getTime()-start;
alert("Tersimpan.\n Lama proses : " + stop);
},
error: function(cek){
alert("Error");
}
});
警報顯示此:
有人能幫助我如何讓它更具可讀性嗎?因爲我不知道我的警報顯示了什麼價值。謝謝。
我修改我的Ajax請求是這樣的:
$.ajax({
type: "POST",
url: "action.php",
data: {
action: "simpanFitur", fitur: $('#feature :selected').val()
},
success: function(time){
alert("Tersimpan.\nLama proses : " + time);
},
error: function(){
alert("Error");
}
});
但警報並未出現time
值。
難道我做錯了什麼?請告訴我。
這是最新的警報:
如何使它更簡單嗎?
如何https://nodejs.org/api/console.html#console_console_time_label? –
時差以毫秒爲單位。以1000分,以秒爲單位。在你的情況488.165秒 –
你也可以在Chrome/Firefox開發者工具中找到有用的信息[看這裏](https://developers.google.com/web/tools/chrome-devtools/network-performance/resource-loading)爲什麼你需要以這種方式跟蹤時間嗎? –