I want to get an array that I used with Ajax. I already used this method with an other page and this time it doesn't work, so I don't see where is the problem.
I have an array :
var array_downloads = <?php echo json_encode($array_downloads);?>;
This array isn't empty, when I do a console.log
I get the content, the list of the elements.
After that, I make my Ajax request like that :
$.post("pack.php", {arr:array_downloads}, function(data) {
...
},'json');
So I send my array to the file .php
.
Finally I want to get the array with this :
$array_downloads = $_POST["arr"];
And when I try to echo it (and I don't forget the json_encode()
), I get null
.
I don't understand why.
Help please !