I have two pages; one of them written in Javascript and other purely PHP.
I try to send a JavaScript array and send it as JSON:
var myarr= new Array(); myarr["170864"]="[email protected]"; myarr["999900"]="[email protected]"; $.ajax({ type: "POST", url: "to_sent_mail.php", data: { envio:myarr }, success: function() { alert('Enviado!'); } });
In the pages "to_sent_mail.php":
$array=$_POST['envio'];
foreach ($array as $codfactura => $lista)
{
$lista_email=split(';',$lista);
echo 'Mandando factura ' ."{$codfactura}" . '<br>';
foreach ($lista_email as $direccion) {
echo 'Direccion: ' . $direccion . '<br>';
}
}
This array isn't sent as code execution doesn't enter foreach loop. I tried debugging XHR in Chrome but I cannot view the content of the request.
"And not enter foreach sentence"How are you ascertaining that?