Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript AJAX Basics (retiring) AJAX and APIs Create a callback function

AJAX and APIs Challenge Task 3 of 3

I'm stuck on the final step. Not sure how to do the following:

Finally, to insert the temperature into the div, use jQuery's text() method. You'll need to pass the temperature into this method. The Open Weather Map API returns an object with the property main; that property holds another object with the property"temp". To access the temperature, use dot syntax, like this:weatherReport.main.temp

$(document).ready(function() {
  var weatherAPI =http://api.openweathermap.org/data/2.5/weather’;
  var data = {
    units: metric
  function showWeather(weatherReport){
};// end of ready
Ken Alger
Ken Alger
Treehouse Teacher

Edited for Markdown.

1 Answer

Ken Alger
Ken Alger
Treehouse Teacher


You are extremely close on this challenge task. A few syntax issues. A) in the #temperature selector you appear to be using backticks. Either single or double quotes are needed. B) You don't want to designate the dot syntax of weatherReport.main.temp as a string, so you can remove those quotes as well, also those appear to be backticks.

Those changes should do the trick.


Hi Ken,

Something weird is going on with those quotes. I don't think they're backticks because they would all be going the same way.

All the quotes including the double ones in the data object look like the slanted quotes or curly quotes you might get from a word processor.

You can compare here:

“metric”  // copied from question
"metric" // typed from my keyboard

Not sure how the starter code got those quotes.

Kerry, you'll have to fix all of the quotes throughout the code as well as fix B) that Ken wrote.

I also noticed when testing your code that you somehow lost the closing parenthesis on .ready()

It was in the last line of the starter code like this: });

Your last line doesn't include it.