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 Set up the data to pass to the API

Charles Harpke
Charles Harpke
33,986 Points

You can get the temperature back from the Open Weather Map API in metric (Celsius) or imperial (Farenheit) units. Add an

What have I left out in the following code? I can't get this to pass:

 $(document).ready(function() {
   var weatherAPI = 'http://api.openweathermap.org/data/2.5/weather';
   var data = {
     q: "Portland,OR"
     units : "metric"
   };

 });

3 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Charles,

You're simply missing the comma after "Portland,OR", put that in and your code will pass.

var data = {
  q: "Portland,OR", // <--- comma here
  units : "metric"
};
Laura Rodriguez
Laura Rodriguez
8,284 Points

$(document).ready(function() { var weatherAPI = 'http://api.openweathermap.org/data/2.5/weather'; var data = {q : "Portland,OR", units :"metric", data:”imperial"}; });