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 trialEric Biz
4,916 PointsWeather API
I have completed all the tasks of this weather challenge but when I launch the browser the temperature is not displayed. Did I miss anything? I have also include the jquery CDN link in the html page. It just says: Current temperature:
2 Answers
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsIt's hard to say without any code - try share your code :-P
Eric Biz
4,916 PointsHere is my code: JQUERY
$(document).ready(function() { var weatherAPI = 'http://api.openweathermap.org/data/2.5/weather'; var data = { q : "Portland,OR", units : "metric" }; function showWeather(weatherReport){ $('#temperature').text(weatherReport.main.temp); } function showWeather(weatherReport){ $('#temperature').text(weatherReport.main.temp); } $.getJSON(weatherAPI,data,showWeather); });
HTML
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>What's the Weather Like?</title> <script src="http://code.jquery.com/jquery-1.12.4.min.js"</script> <script src="weather.js"></script> </head> <body> <button type="button" id=btn382>Click Me!</button> <div id="main"> <h1>Current temperature: <span id="temperature"></span>Ā°</h1> </div> </body> </html>