CORS Policy error No 'Access-Control-Allow-Origin'

Tagged:

Currently contains 1 post

Avatar

January 30, 2019 00:21

Roman Kitainik

Running this code in Chrome console:

var wuAppId = ‘xxx’;
var wuAppKey = ‘yyy’;
jQuery.getJSON(‘https://api.weatherunlocked.com/api/current/ZZ.28,WW.12’ + ‘?app_id=’ + wuAppId + ‘&app_key=’ + wuAppKey)
.done(function(data) {
window.dataLayer.push({
event: ‘weatherDone’,
weather: data.wx_desc,
temperature: data.temp_c
});
}).fail(function(jq, status, msg) {
console.log(’Weather request failed: ’ + status + ’ – ’ + msg);
});

results in the following message:

Access to XMLHttpRequest at ‘https://api.weatherunlocked.com/api/current/ZZ.28,WW.12?app_id=xxx&app_key=yyy’ from origin ‘https://sub.domain.tld’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Is there anything I can do on my side to fix it? Thanks.

Reply to thread
  1. If you're human, leave this field empty.