I keep getting “No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘null’ is therefore not allowed access.” when I try the call below.
$.ajax({
url: ‘http://api.weatherunlocked.com/api/forecast/51.50,-0.12?app_id=app_id&app_key=app_key’,
type: ‘GET’,
dataType: “json”,
success: function () {
alert(‘suc’);
},
error: function (error) {
alert(‘fail’);
}
});
Hi Hagan,
We’ve just added Cross-Origin Resource Sharing (CORS) support to our local weather api.
You should now be able to get a valid response.
Please let us know if you need anything else.
Regards.
Awesome! Thanks! Works like a champ now!
Hagan
I’m getting the same thing. I can call the api directly in a browser and get a response, but if I try to call it from a webpage, I get the error:
SEC7120: [CORS] The origin ‘http://www.domain.com’ did not find ‘http://www.domain.com’ in the Access-Control-Allow-Origin response header for cross-origin resource at ’https://api.weatherunlocked.com/api/current/51.5,-0.1?app_id={id}&app_key={key}.
HTTP403:
FORBIDDEN – The server understood the request, but is refusing to fulfil it.
(XHR)GET – https://api.weatherunlocked.com/api/current/51.5,-0.1?app_id={id}&app_key={key}.
Is there CORS support for https calls as well ?