im trying to send a array from javascript to php using ajax. My problem is that array in PHP is empty and i dont know why.
My array: vacio['num1:1','num2:2'....]
this my javasvascript:
var vacio = new Array;
vacio = addElementAttributesToArrayEncode();
var miJSON = JSON.stringify(vacio);
var miAjax = new Request({
type: "POST",
url: "/multyWeb/actions/maintenance/mUpdateProductAction.php",
data: "ark=" + miJSON,
onSuccess: function(textoRespuesta){
console.log("ok");console.log(textoRespuesta);
},
onFailure: function(){
console.log("fallo");
}
})
miAjax.send();
And this is my php:
if($_POST){
echo "recibo algo POST Producto";
//recibo los datos y los decodifico con PHP
$str = json_decode($_POST['ark'], true);
echo json_encode($str); }
else { echo "Error del POST";}
And the array $str is empty... what is wrong?
thanks