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 trialAlexis Ruiz
9,237 PointsMy code is not working at all :(
$('form').submit(function (evt) { console.log('hola'); evt.preventDefault (); var $tag = $('#seacrh'); var url = 'http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?'; var data = { tag: $tag, format:"json" } console.log('hola'); console.log($tag); console.log(data); function callback (response) { console.log(data); $.each(response, function (i, photo){ photosHTML = '<li class = "grid-25 tablet-grid-50">'; photosHTML += '<a href = " ' + photo.media.m + '" ></a></li>'; }); $('#photos').html(photosHTML); } $.getJSON(url, data, callback); });
Nothing is running, not even the console logs are working. I think it is obvious that the problem is the event listener because if I console.log out of it, it works. But I can-t see any difference between my code and Dave's code. :(
Alexis Ruiz
9,237 Pointsdeebird Yes I am loading Jquery :(
3 Answers
deebird
7,558 PointsUpon a quick test I get your console.log when I wrap it in a doc ready
Alexis Ruiz
9,237 PointsLOL. Thank you man!
James MacDonald
Courses Plus Student 6,268 PointsDoes your code actually start with the word "JavaScript"? Also, you're missing a semicolon after
var data = { tag: $tag, format: "json" }
Alexis Ruiz
9,237 PointsFixed it already, but still it doesn't solve the main problem. I can't even log anything inside the event listener $('form').submit(function (evt) {});
I don't understand why.
James MacDonald
Courses Plus Student 6,268 Points...and you may have mispelled #seacrh
deebird
7,558 Pointsdeebird
7,558 Pointsyou loading jquery?