I have a button with "orderdetail" class in a html document . I want to get it's id by jquery and send it to the php document then redirect to that php document and then I process that id by POST , but I always get "Notice: Undefined index: id in C:\laragon\www\portal\orderDetail.php on line 9" error. this is my code :
in html doc:
$(document).on('click', '.orderdetail', function () {
var _id = $(this).attr("id");
console.log(_id); //I got the true result here
$.post("orderdetail.php", { id: _id }, function (data, status, xhr) {
window.location.href = "orderdetail.php";
})
.... more code not shown
in php doc: echo $_POST['id'];
What's the problem?