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

gregory gordon
gregory gordon
Full Stack JavaScript Techdegree Student 14,652 Points

Finally, to insert the temperature into the div, use jQuery's text() method. You'll need to pass the temperature into th

i dont understand how im doing this

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

<!DOCTYPE html>
  <meta charset="utf-8">
  <title>What's the Weather Like?</title>
  <script src="jquery.js"></script>
  <script src="weather.js"></script>
  <div id="main">
    <h1>Current temperature: <span id="temperature"></span>&deg;</h1>

2 Answers

Jessica Jimenez Hageman
Jessica Jimenez Hageman
7,670 Points

This worked: $('#temperature').text(weatherReport.main.temp);

Tom Sager
Tom Sager
18,987 Points

<p>You are very close!</p> <p>Without an argument, the text() method returns the text associated with the currently selected element(s).</p> <p>With an argument, it replaces the text with that argument. So

$('#temperature').text('this is an example')

will change the text to "this is an example".</p> <p>Simply replace string in the above code with the current temperature. You can pass a string, number, boolean or function to text().</p>