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 Call the jQuery $.getJSON method

Jamie Bradley
Jamie Bradley
7,148 Points

AJAX GET method

I'm on stage four of AJAX and APIs and I've tried every variation of the function portion of the AJAX GET method and nothing works. I'm clearly writing something incorrectly, but I have no idea what. This is what I have:

$(document).ready(function() {

  var weatherAPI = 'http://api.openweathermap.org/data/2.5/weather/?jsoncallback=?';
  var data = {
    q : "Portland,OR",
    units : "metric"

 function showWeather(weatherReport) {

  $.getJSON(weatherAPI, data, showWeather);


1 Answer

Dave McFarland
Dave McFarland
Treehouse Teacher

Hi Jamie Bradley

You don't need to add ?jsoncallback=? to the end of the openweathermap URL.

Jamie Bradley
Jamie Bradley
7,148 Points

Ha, no I did not :) Thank you!