From an Ajax function i’m running a php function that does a simple insert to a mysql table.
If it has no issues i just return a 1 and if it has an error it is caught by an exception and returns a json_encode($ex). Since the ajax function has a dataType of “json” it’s all good, except i get this in my answer variable:
{
"errorInfo": [
"23000",
1062,
"Duplicate entry 'a' for key 'usuarios.usuario'"
]
}
And it looks good but if i try something like console.log(answer["errorInfo][1]);
to try to get just the code error i get some undefined errors and whatnot.
How can i access, individually, those 3 indexes inside of the errorInfo key?