0

I echo two thing like

PHP

echo json_encode($obj);
echo json_encode($obj2);

and how I receive it? I thought everything will be fall into the data param. But I got an error saying

SyntaxError: Unexpected token { at Object.parse (native)

$http({
method: 'GET', 
url: 'path'
}).
success(function(data, status, headers, config) {

}
1
  • 2
    Why don't you merge the two together, encode/output that, then break them up again on with the AJAX success function? Commented Jan 30, 2014 at 3:37

1 Answer 1

1

Seams like the second json is giving the problem. Just send one:

PHP

$mixed["obj1"] = $obj1;
$mixed["obj2"] = $obj2;

echo json_encode($mixed);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.