Custom Widget on portals Accessing external URL


#1

I Want to compare some of the data that I am uploading to portals, to some external data.
for example from this URL:

http://maine.loboviz.com/cgi-data/nph-data.cgi?newest=12&y=temperature&data_format=text&node=66

I am having trouble pulling data from that site but not this one:
https://ghibliapi.herokuapp.com/films

Here is my custom code:

var request = new XMLHttpRequest();

request.open(‘GET’, ‘https://ghibliapi.herokuapp.com/films’, false);
request.onload = function () {
if (request.status >= 200 && request.status < 400) {
console.log(request.responseText);
} else {
console.log(‘error’);
}
}

request.send();

Any help is appreciated.

Thanks

Joshua