Basically my problem is that when i fetch data using $http.get
method of the AngularJS , the Json encoded data which is printed by the PHP doesnt render in the website instead it shows as plain text.. for ex when PHP prints <h3 class=\"someclass\">Hello World<\/div>"
and also simultaneously i try to parse the JSON using JSON.parse but it gives me Syntax Error: Unexpected token o
. Basically the received HTML markup is not rendered.. Its just as plain text..
See below:
The h3
tag that i rectangled in black doesn't render in the page. Even in the source you can see its not as a markup but as a plain text.
Object {failData: "<h3 class="emptyBox">Write Your 1st Note !!</h3>"} controller.js:19
– ChanX Jan 22 at 7:37{failData....}
, there is wrong quote nesting. The stringfailData
is only"<h3 class="
, after that is only gibberish. To create JSON strings in PHP, usejson_encode
: php.net/manual/de/function.json-encode.php – opatut Jan 22 at 7:42