jQuery JSON help

Posted by kim on Stack Overflow See other posts from Stack Overflow or by kim
Published on 2011-01-06T21:42:31Z Indexed on 2011/01/06 21:53 UTC
Read the original article Hit count: 183

Filed under:
|
|

okay I'm new to jQuery and JSON but I have now done so I got some information from the database in JSON format and now I want to show the results in a nice way but I don't know how ;)

what I want is to show 5 newest threads on my page so will this script try to load all the time or do I need to do something else?

I want it to show the 5 newest threads and when there somes a new thread i should slide down and the 6 threads at the bottom should disappear

Here is my code

<script type="text/javascript">
$.getJSON('ajax/forumThreads', function(data) {
    //$('<p>' + data[0].overskrift + '</p>').appendTo('#updateMe > .overskrift');

    $('<div class="overskrift">' + data[0].overskrift + '</div>') {
        $(this).hide().appendTo('updateMe').slideDown(1000);
    }

    //alert(data[0].overskrift);

});
</script>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX