I'm trying to send an array from JavaScript to PHP with the $.post()
method of Jquery.
I've tried jQuery.serialize()
, jQuery.serializeArray()
, JSON.stringify()
and all of them didn't work.
Here is my code:
$.post("ajax/"+action+"_xml.php",{'array': array},function(data){console.log(data);});
the array looks like this :
array["type"]
array["vars"]["name"]
array["vars"]["email"]
array["vars"] has more than 2 elements.
The result in my php $_POST
variable is an empty array (length 0).