How I can parse 2 JSON objects? e.g
AJAX return just one Object appear's correctly.
Object {32 : "Joseph"}
But, when return more than 2 objects, I've got this:
ResponseText: "{"users":{"32":"Jospeh"}}{"users":{"48":"Jospeh K."}}"
I already trieD to parse with JSON.parse but returns an error: "Uncaught SyntaxError: Unexpected token {"
So, How I can parse to return something like this:?
Object {32 : "Joseph"}
Object {48 : "Joseph K"}
Instead of "responseText"
Considerations:
- If returns just ONE object, appears correctly in console(example);
- If returns more than TWO objects, appears responseText;
- AJAX dataType: JSON
I'll be very grateful if someone can help with this. =D
PHP:
public function get_error_message()
{
$message = "";
foreach ($this->errors as $value) {
if ($value instanceof UsersError) {
$message.= json_encode(array('errors' => array($value->getCode() => $value->getMessage())));
}
}
return $message;
}