Reputation: 20895
I am using jQuery Ajax to return a JSON object (with dataType: 'json'
) from a PHP file. Here is the returned JSON string that the PHP file echoes out.
{'works': true,'text':'<div class=\'animal\'>Elephant</div><br />'}
The Chrome web developer console notes Error:parsererror SyntaxError: Unexpected token '
. I do not see, however, where an unexpected single quote could be.
Upvotes: 1
Views: 2191
Reputation: 1500
This question is similar of your problem. The echo is correct. See extra content return to client Creating JSON data using PHP and parsing it using jQuery
Upvotes: 1