Ajax通知 - 未定义的索引:id

I really need your help to deal with an AJAX request.

function detailsmodal(id){
    jQuery.ajax({
        url: "/E-shop2/views/details-model.php",
        type: "POST",
        data: {'id' : id},
        success: function(returnData){
        jQuery('#details-window').modal('toggle');
        },
        error: function(){
            alert("SOmething went wrong");
        }
    });
}

php file

$id =  $_POST['id'];
$id = (int)$id;

For some reason it does not recognize the index id from the post method and I get a notice. Do you have any idea what is the problem and how I can fix it?

At Left hand always a varible.So you need to define change variable name in data part.

function detailsmodal(sid){
        jQuery.ajax({
            url: "/E-shop2/views/details-model.php",
            type: "POST",
           /*** data: {'id' : id}, // Replace Here {id : id}*/
            data: {id : sid},
            success: function(returnData){
            jQuery('#details-window').modal('toggle');
            },
            error: function(){
                alert("SOmething went wrong");
            }
        });
    }