Wanderlust Project -- Step 12

Hello,

I am having issues with the Wanderlust project on Step 12. In the JavaScript console, I see the following error message:
Cross-Origin Read Blocking (CORB) blocked cross-origin response https://rum.browser-intake-datadoghq.com/api/v2/rum?ddsource=browser&ddtags=sdk_version%3A4.4.0%2Cenv%3Aproduction%2Cservice%3ACodecademy-production%2Cversion%3A3abf870d&dd-api-key=pub4b4c157b8033dcd97e14c779a3ca222c&dd-evp-origin-version=4.4.0&dd-evp-origin=browser&dd-request-id=83049683-71db-428b-9b3c-610865310473&batch_time=1647628105818 with MIME type application/json. See Cross-Origin Read Blocking (CORB) - Chrome Platform Status for more details.

Here is my code so far:

// Foursquare API Info
const foursquareKey = ‘redacted’;
const url = ‘https://api.foursquare.com/v3/places/search?near=’;

// OpenWeather Info
const openWeatherKey = ‘redacted’;
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 $placeDivs = [$("#place1"), $("#place2"), $("#place3"), $("#place4")];
const $weatherDiv = $("#weather1");
const weekDays = [‘Sunday’, ‘Monday’, ‘Tuesday’, ‘Wednesday’, ‘Thursday’, ‘Friday’, ‘Saturday’];

const options = {
method: ‘GET’,
headers: {
Accept: ‘application/json’,
Authorization: foursquareKey
}
};

// Add AJAX functions here:
const getPlaces = async () => {
const city = $input.val();
const urlToFetch = ${url}${city}&limit=10;
try {
const response = fetch(urlToFetch, options);
if (response.ok) {
console.log(response);
}
} catch(error) {
console.log(error);
}
};

Any help is appreciated. Thanks!

const urlToFetch = ${url}${city}&limit=10 ;

This part should be in template literals

Hello, thank you very much for your reply. For whatever reason, the template literals didn’t show in what I posted, but they were already there and it’s still not working.

Update: I was able to move past this step. I was missing the ‘await’ keyword in the ‘const response’ variable.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.