Can't load API data

  function setup() { 
  createCanvas(400, 400);
  var url = "http://api.openweathermap.org/data/2.5/weather?q=London&appid=______&units=metric"
  loadJSON(url);
}

Hi! When I try to load JSON data from this weather API, I get this error:

Uncaught TypeError: Cannot read property ‘split’ of undefined (: line 56)

I can’t find anything in the reference, and in this video on The Coding Train which I’m following, I can’t see any difference between what Mr Shiffman is doing and what I’m doing.

video: https://youtu.be/ecT42O6I_WI

I have tried passing the string in as an argument directly, as a variable such as in the code; specifying “jason” and “jasonp” in the datatype, using preload, and generally fumbled about.

I have also tried pasting the address into the URL bar and that does work.

Does anyone have any idea?

I have omitted the API key for privacy.

Thanks!

p5js.org/reference/#/p5/preload
p5js.org/reference/#/p5/loadJSON

I have managed to solve the problem by manually changing the “http” element to “https”.