I know this seems like already asked question, but I did research and none of the solutions worked for me. I have an javascript array like this:
[from: "2016-04-01", to: "2016-04-14"]
And I'm sending it via AJAX on the same page, like so:
data.date=date;
console.log(data.date);
$.ajax({
url: "",
type: "POST",
dataType: "JSON",
data: data,
async: true,
success: function (data) {
}
});
And I put var_dump($_POST['date']); at the beginning of my page. When I look at Network took of my browser I can see that request is sent, and my page is listed within Network pages, but $_POST['date'] array is NULL. And I did put this JS code within $(document).ready();, so that cannot be the issue. I just want to get value of this javascript array into php variable.
JSON.stringify(data)to thedataparam.