I manage to solve all of the problems i encountered on my own, by reading reference page, googling, by watching yt tutorials… but i have problem with loading JSON with url which is not working even thought I done everything by the book…
Here is the code, the simplest possible - and it’s not working:
function setup() {
var url = 'http://api.open-notify.org/iss-now.json';
loadJSON(url, gotData, 'jsonp');
}
function gotData (data) {
print (data.iss_position.latitude);
}
It’s not working with or without “jsonp” argument.
If i put the json content in local file called iss.json, than it’s working.
function setup() {
// createCanvas (600,400);
var url = 'iss.json';
loadJSON(url, gotData);
}
function gotData (data) {
print (data.iss_position.latitude);
}
The same is with open weather API, it’s not retrieving the data.
But earthquake.usgs.gov from reference loadJSON example is working just fine…
Hi! I can open the json in browser without a problem. I now figured out use of console (i use p5.js web editor)… so i find out that i am getting errors:
Mixed Content: The page at 'https://editor.p5js.org/Ivanko/sketches/rJ7nG9R6X' was loaded over HTTPS, but requested an insecure resource 'http://api.open-notify.org/iss-now.json'. This request has been blocked; the content must be served over HTTPS.
VM111 about:srcdoc:1 Uncaught (in promise) TypeError: Failed to fetch
VM111 about:srcdoc:1 Uncaught (in promise) TypeError: Failed to fetch