Я получаю неожиданную ошибку токена в консоли при обращении к Open Weather API.
function ajaxCall() {
var xhttp = new XMLHttpRequest();
xhttp.open("POST", api.openweathermap.org/data/2.5/weather?zip=94040,us);
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.send();
var response = JSON.parse(xhttp.responseText);
console.log(response);
}
Неопределенный токен ошибки - это запятая между почтовым индексом и страной.
Вам не хватает котировок на вашем URL-адресе. Изменить:
xhttp.open("POST", api.openweathermap.org/data/2.5/weather?zip=94040,us);
чтобы:
xhttp.open("POST", "api.openweathermap.org/data/2.5/weather?zip=94040,us");
+
"api.openweathermap.org/data/2.5/weather?zip=94040,us"