Mazel:test: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
No edit summary
No edit summary
Line 8: Line 8:
                           var items = [];
                           var items = [];


                           $.each(data, function(key, val) {
                           $.each(data, function(pap) {
                                 items.push('<li id="' + key + '">' + val + '</li>');
                                 items.push('<li id="' +pap.title + '">' + pap.authors + '</li>');
                           });
                           });



Revision as of 06:11, 7 March 2011

<html> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() {

 $.getJSON('http://www.citeulike.org/json/group/5581?callback=?', 
           function(data) {
                          var items = [];
                          $.each(data, function(pap) {
                                items.push('<li id="' +pap.title + '">' + pap.authors + '</li>');
                          });
                          $('<ul/>', {
                                'class': 'my-new-list',
                                 html: items.join('')
                          }).appendTo('#papers');
            });

});


document.writeln("coucou"); </script>

<a href="">Link</a> <div id="papers"></div> <div id="images"></div> </html>