First pass the array from php using
$row['text'] = <img src="http://ajaxs.ru/demo/js/smail/smail/sleep.png">;//из базы данных $msg[] = array("msg"=>htmlspecialchars($row['text'])); echo json_encode($msg);
Then I accept an array. Here is the Javascript code:
var obj = JSON.parse(msg_j); for(var i=0; i < obj.length; i ++){ $('#chatIn').append(obj[i].msg); }
Displays: <img src="http://ajaxs.ru/demo/js/smail/smail/sleep.png">
And you need to display a picture, not HTML code.