如何以正确的方式使用jQuery提醒时间进程?

I want to show the time of process of my php code using jQuery


My php code example :

<?php 
   //some queries to database
?>

Here's my jQuery:

$.ajax({
        type: "POST",
        url: "action.php",
        data: {
            action: "simpanFitur", fitur: $('#feature :selected').val()
        },
        success: function(){
            var stop = new Date().getTime()-start;
            alert("Tersimpan.
 Lama proses : " + stop);
        },
        error: function(cek){
            alert("Error");
        }
    });

The alert show this :

enter image description here

Can somebody help me how to make it more readable ? Because I dont know what value that showed on my alert. Thank you.

I've modified my ajax request to be like this :

$.ajax({
        type: "POST",
        url: "action.php",
        data: {
            action: "simpanFitur", fitur: $('#feature :selected').val()
        },
        success: function(time){
            alert("Tersimpan.
Lama proses : " + time);
        },
        error: function(){
            alert("Error");
        }
    });

But the alert didn't show the time value.

enter image description here

Did I do something wrong ? Please tell me.

This is the latest alert :

enter image description here

How to make it more simple ?

You could always return in the action.php response a key called time containing the total time the request took, then you can handle this in your success section and display as you wish.

You could generate the value of time with:

$time = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"];