as the title stated. how do i do that? i read in some forum to use stringify? and how do i use it?
PHP:
$notes = $db->query("SELECT * FROM notes WHERE id_user = '$id_user'");
$output = array();
while($note = $notes->fetch_assoc()) {
$noting = '<span class="block_note">'.$note['note'].'</span>';
array_push($output, $noting);
}
$data['ok'] = true;
$data['message'] = $output;
echo json_encode($data);
jQuery:
$.get("include/get_details.php?id_user=1",function(data){
if (data.ok){
$.each(data, function(key,id){
$("#notes").append(data.message);
})
}
}, "json");
Output:
{
"ok":true,
"message":[
"<span class=\"block_note\">note1<\/span>",
"<span class=\"block_note\">note2<\/span>",
"<span class=\"block_note\">note3<\/span>"
]
}