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 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>