Open weather maps

Я создаю приложение погоды, которое использует геолокацию, но также и поиск.

Функция для геолокации работает, но поиск пользователя не работает; ошибка в консоли: GET {api url} 404 (не найдено).

Во-первых, функция, которая НЕ работает:

function getWeatherWithUserInput() { return new Promise(function(resolve, reject) { var location = $(«#location»).val().trim(); var widget = Mixcloud.PlayerWidget(document.getElementById(‘my-widget-iframe’)); var weatherCSQueryURL = «http://api.openweathermap.org/data/2.5/weather?q=» + location + «=&appid=» + WeatherAPIKey; $.ajax({ url: weatherCSQueryURL, method: «GET» }).done(function(response) { //$(«.city»).html(«<h1>» + response.name + » Weather </h1>»); $(«.wind»).html(«<h1>» + response.name + «</h1>»); //$(«.humidity»).html(«Humidity: » + response.main.humidity); //var f_temp = 9/5*(response.main.temp-273)+32; //$(«.temp»).html(«Temperature (F) » + Math.floor(f_temp)); resolve(response.weather.id); }); }); };

теперь функция, которая работает:

function getWeatherWithGeo() { return new Promise(function(resolve,reject) { getGeoLocationGoogle() .then(function(response) { var lat = response.location.lat; var lon = response.location.lng; var weatherLLQueryURL = «http://api.openweathermap.org/data/2.5/weather?lat=» + lat + «&lon=» + lon + «&appid=» + WeatherAPIKey; $.ajax({ url: weatherLLQueryURL, method: «GET» }).done(function(response) { $(«.wind»).html(«<h1>» + response.name + «</h1>»); resolve(response.weather.id); }); }) }) }

Кажется, я не вижу разницы, почему один будет работать, а другой — нет. Любые предложения приветствуются!