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

Tony Huang
Tony Huang
5,081 Points

does "weatherReport.main.temp" wrong?

does "weatherReport.main.temp;" wrong?

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

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

1 Answer

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,333 Points

The instructions state:

You'll need to pass the temperature into this method.

This means weatherReport.main.temp goes in between the parentheses for text() like this

$("#temperature").text(weatherReport.main.temp);