I have an ajax call that fires a php script that returns an array.
the php:
$errors[1] = "you didn't enter name";
$errors[2] = "your email is incorrect";
$errors[3] = "You didnt enter password";
echo json_encode($errors);
the javascript:
.....
datatype:'json',
success: function(result)
{
alert(result);
}
I would expect to see:
{"1":"you didn't enter name","2":"your email is incorrect","3":"You didnt enter password"}
instead i see: ["you didn't enter name","your email is incorrect","You didnt enter password]
it seems like the json_encode did something funky. what am i missing
$errors['1']and what you have is$errors[1].