Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript AJAX Basics (retiring) AJAX and APIs Stage 4 Challenge

Whats the porblem with my app.js ??

$(document).ready(function() { $('form').submit( function (evt) { var flickerAPI = "http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?"; evt.preventDefualt(); var animal = $('#search').val(); $.getJSON(flickerAPI,{ tags: animal, format: "json" }, function (data) { var flikerHtml = ''; if(data.items.lenght > 0) { $.each(data.items ,function (i, item) { flikerHtml += '<li class="grid-25 tablet-grid-50">'; flikerHtml += '<a href="'+ item.link +'" class="image">'; flikerHtml += '<img src="'+ item.media.m +'"></a></li>'; }); //End of showImages } else { flikerHtml = "<p>No Images Foundv "+ animal +".</p>"; } $('#photos').html(flikerHtml); }); // getjson });// End of submmit }); // end ready

1 Answer

heather918
heather918
6,375 Points

You have typos in your code. Try correcting those first and see if it doesn't run.

preventDefualt data.items.lenght