$data = ['success' => false; 'message' => 'Тест', 'phone' => $_POST['phone']];
header('Content-Type: application/json');
echo json_encode($data);
$.ajax({
type: 'post',
url: '/script.php'. // без http:// и домена
dataType: 'json',
data: {id: 5555, phone: 4444},
success: function(data) {
if (!data.success) {
$("#error").html(data.message);
console.log(data.phone); // 4444
}
}
});
$_POST
ищите.