I have several products. On click product, I send "id" of clicked product to Local Storage. To use this variable in php I send it to items.php ($.post).
Then I need use this "id" from items.php to show in the cart, but variable is emply.
var LSArray = JSON.parse(localStorage.getItem('productID')) || [];
function clickOnProduct(id) {
    var newItem = {'id': id};
    LSArray.push(newItem);
    localStorage.setItem("productID", JSON.stringify(LSArray));
    var dataLS = JSON.parse(localStorage.getItem('productID')) ;
    $.ajax({
                type : "POST", 
                url  : "/wp-content/themes/twentynineteen/items.php", 
                data : { name : dataLS[dataLS.length-1].id },
                success: function(res){  
                    console.log(res);
                }
        });
}
All works fine, but how can I use "id"?
<?php incude(items.php); ?> 
dosn't work.
 
    