如何在URL中转换此JavaScript

I have this code :

function name() {
    $.ajax({
      type: "POST",
      url: "/index.php",
      data: { id:  $("#id").val(),  date: new Date().getTime()}, 
    }); 
}

I would like to understand what is the translation to put in a URL. I have tried everything and it doesn't work. In my mind, it should be index.php?id= ... but no.

an alternative would be:

function name() {
    $.get('index.php?id=' + $("#id").val() +'&date ='+ new Date().getTime() +'',function(data){
        //work with the data callback here.
    });
}

Try this :

function name() {
    $.ajax({
      type: "GET",
      url: "/index.php",
      data: { id:  $("#id").val(),  date: new Date().getTime()}, 
    }); 
}

And receive id and date with $_GET['id'] , $_GET['date']...

If you use POST type, You have to receive with $_POST.