I have two arrays and I need to send the array values to PHP. When I print the value that returns from PHP, it prints an empty string. How can I get it? my code is below.
$.ajax({
type: "POST",
url: "test2.php",
data: {
price: [101, 69, 51],
id: [1, 2, 3]
},
success: function(response) {
alert(response);
}
});
In PHP
$id=mysql_real_escape_string($_POST['id'][0]);
echo $id;