Looping json_encoded data
Hey I have a json_encode which im trying to loop and display the output but its not working, i get no output =/

This is my js fiddle:
http://jsfiddle.net/Z4jTc/1/

Can some one explain why it won't loop?


Code:

    var messages = {"1":["2","1","0000-00-00 00:00:00","testing once"],"2":["2","1","0000-00-00 00:00:00","testing twice :)"]};

        for(var id in messages){
 
                var read = messages[id][0];
                var from = messages[id][1];
                var sent_on = messages[id][2];
                var content = messages[id][3];
       
                document.write = 'test';
                document.write = '<div class="message_info">';
                document.write =  '<b>From:</b> '+from+'<br/><br/>';
                document.write = '<b>Sent On:</b> '+sent_on;
                document.write = '</div><div class="message_content">';
                document.write = content;
                document.write = '</div> <br/><br/>';
       
        }​
Looping json_encoded data
===

Hey I have a json_encode which im trying to loop and display the output but its not working, i get no output =/

This is my js fiddle:
http://jsfiddle.net/Z4jTc/1/

Can some one explain why it won't loop?


Code:

    var messages = {"1":["2","1","0000-00-00 00:00:00","testing once"],"2":["2","1","0000-00-00 00:00:00","testing twice :)"]};

        for(var id in messages){
 
                var read = messages[id][0];
                var from = messages[id][1];
                var sent_on = messages[id][2];
                var content = messages[id][3];
       
                document.write = 'test';
                document.write = '<div class="message_info">';
                document.write =  '<b>From:</b> '+from+'<br/><br/>';
                document.write = '<b>Sent On:</b> '+sent_on;
                document.write = '</div><div class="message_content">';
                document.write = content;
                document.write = '</div> <br/><br/>';
       
        }​