ajax call tell me why....
Hi.
Just corious...
Why if I made the call like this, the 2 array are passed to php with all the elements in it.
$.ajax({type: "POST",
url: "/req.php",
data:"dipendenti="+array1+
"&giustificativi="+array2,
success: function(data){
$("#divTesto").html(data);
}
});
If I made the call like this the 2 arrays are only with one element (the last I think).
$.ajax({type: "POST",
url: "/req.php",
data: {
dipendenti: array1,
giustificativi: array2
},
success: function(data){
$("#divTesto").html(data);
}
});
In the php script I made a $_POST['arrayname']; in both case.
The 2 array in java are from a for cycle and are filled with array.push.
The strange thing that I don't understand is that in the first case the array is full of element and in the variable of the $post I have all element separated by comma.
After that i split and make an php array.