So I just deployed it to Web Server for Chrome to check if it worked. What I'm doing is simply calling a get with JS.
var request = new XMLHttpRequest();
var url1 = fixUrl();
request.open("GET",url1,true);
request.setRequestHeader('Content-Type', 'application/json');
request.send();
fixUrl returns the full URL with fixed query and inserted APIKey. Anyways when I call the request, I can an error 404. What seems to happen is that Web Server for Chrome extends my fixed URL from the beginning, adding it's own URL to the request. My error looks like this:
script.js:23 GET http://127.0.0.1:8887/api.openweathermap.org/data/2.5/weather?q=austin&appid=XXXX 404 (Not Found). So why on earth does it add the first part of the url to my get request, I have not specified it anywhere in my code?
Even if I alert the url after my error it still gives me the correct string
It seems to me like fixUrl()
does not return the full url, just the address. Try making it return '//' + whateverFixUrlWasReturning
or 'https://' + whateverFixUrlWasReturning
or http://
, of course... depending on your needs