Ajax: Add new <div> from JSON with jQuery

Posted by Francesc on Stack Overflow See other posts from Stack Overflow or by Francesc
Published on 2010-06-13T10:59:05Z Indexed on 2010/06/13 11:02 UTC
Read the original article Hit count: 270

Filed under:
|
|

Hi,
In a page I have this HTML code:

 
<div id="content">
    <div class="container">
        <div id="author">@Francesc</div>
        <div id="message">Hey World!</div>
        <div id="time">13/06/2010 11:53 GMT</div>
    </div>
    <div class="container">
        <div id="author">@SomeOtherUser</div>
        <div id="message">Bye World!</div>
        <div id="time">13/06/2010 14:53 GMT</div>
    </div>
    <div class="container">
        <div id="author">@Me</div>
        <div id="message">Hey World!</div>
        <div id="time">13/06/2010 18:53 GMT</div>
    </div>
</div>
I want to ask, how to get a JSON file, from the server that has more recent messages and put them to the top, I mean above the first <div class="container">.

Another question, it's possible to pass with GET when submiting the request to the server, the time of last update? How can I do it?
Thanks.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX