In my page I need to send an array in javascript to Phpscript. My code doesn't return a value and does not give an error. How can I do that?
arr[0]='one';
arr[1]='two';
arr[2]='three';
arr[3]='four';
$.post(
'sort2.php',
{data:arr},
function(result) {
alert(result[0]);
},
'json'
);
In sort2.php
$data=$_GET["arr"];
echo json_encode($data);
$_GETarray?$_POSTarray