i have a a php page to retrieve the new messages from database and send report about them in json if new message its body will contain no html except some inserted brs (<br/>
)
when the json is received in javascript i find all brs coverted from this (<br/>
) to (<br\/>
)
so its job disabled
when i tried to do with other html like
<?php
$a="<html><br/></html>";
echo $a,"\n";
echo "Normal: ", json_encode($a), "\n";
echo "Tags: ", json_encode($a,JSON_HEX_TAG), "\n";
echo "Apos: ", json_encode($a,JSON_HEX_APOS), "\n";
echo "Quot: ", json_encode($a,JSON_HEX_QUOT), "\n";
echo "Amp: ", json_encode($a,JSON_HEX_AMP), "\n";
echo "All: ", json_encode($a,JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP), "\n\n";
?>
the out put was like this
<html><br/></html>
Normal: "<html><br\/><\/html>"
Tags: "\u003Chtml\u003E\u003Cbr\/\u003E\u003C\/html\u003E"
Apos: "<html><br\/><\/html>"
Quot: "<html><br\/><\/html>"
Amp: "<html><br\/><\/html>"
All: "\u003Chtml\u003E\u003Cbr\/\u003E\u003C\/html\u003E"
its my first time to send html in json previously always data (plain text). what has caused this and what can i do to solve this problem??????????
thanks to all those who tried to help because i need it quickly i used this
$("selector").html(result.messageBody.replace("\/","/"));