var species = {}; $('document').ready(function(){ $.get( "/species", function( species_r ) { species_r.data.map(function(item) { species[item._id] = item }); $( "#body" ).load( "/templates/home.html", function(){$("#load").fadeOut("slow"); $.get("/info", function( data ) { var text = "" $.each(data, function(i, obj) { text += ""; }); text += "
"+i+" "+obj+"
" $( "#info" ).html( text ); $("#load").fadeOut("slow"); }); }); $("body").bgswitcher({ images: ["/images/bg0.jpg", "/images/bg1.jpg", "/images/bg2.jpg", "/images/bg3.jpg", "/images/bg4.jpg"], loop: true, duration: 1500 }); }); });