// Foursquare API Info const clientId = 'xx'; const clientSecret = 'xx'; const url = 'https://api.foursquare.com/v2/venues/explore?near='; // OpenWeather Info const openWeatherKey = 'cf8f97af3b65a34755282f756ae84a52'; const weatherUrl = 'https://api.openweathermap.org/data/2.5/weather'; // Page Elements const $input = $('#city'); const $submit = $('#button'); const $destination = $('#destination'); const $container = $('.container'); const $venueDivs = [$("#venue1"), $("#venue2"), $("#venue3"), $("#venue4")]; const $weatherDiv = $("#weather1"); const weekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; // Add AJAX functions here: const getVenues = () => { const city = $input.val(); const urlToFetch = `${url}${city}&limit=10&client_id=${clientId}&client_secret=${clientSecret}&v=${20211120}`; try { const restResp = async (urlToFetch) => { return await fetch(urlToFetch) } const response = restResp(urlToFetch) console.log(response); if(response.ok) { console.log(response); } } catch(error) { console.log(error); } } const getForecast = () => { } // Render functions const renderVenues = (venues) => { $venueDivs.forEach(($venue, index) => { // Add your code here: let venueContent = ''; $venue.append(venueContent); }); $destination.append(`

${venues[0].location.city}

`); } const renderForecast = (day) => { // Add your code here: let weatherContent = ''; $weatherDiv.append(weatherContent); } const executeSearch = () => { $venueDivs.forEach(venue => venue.empty()); $weatherDiv.empty(); $destination.empty(); $container.css("visibility", "visible"); getVenues() getForecast() return false; } $submit.click(executeSearch)