From the course: JavaScript: Ajax and Fetch

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Fix an Ajax request

Solution: Fix an Ajax request - JavaScript Tutorial

From the course: JavaScript: Ajax and Fetch

Start my 1-month free trial

Solution: Fix an Ajax request

(upbeat music) - [Narrator] So the API requests in this file for Smarty Streets is broken. Now, the first thing we need to do is update the API Key. So again, because this was all in a single URL, I broke that out into a variable. Created this smartyAPIKey variable that's going to store the API Key. So you want to replace that value, I went ahead and copied my API KEY, and I'm just going to paste it in there. And so now, that API Key is concatenated with the rest of that URL, to create my request URL. So, I'm going to save that, I'm going to go to my HTML file and we'll just start by going live and checking out what things look like. So, I'm going to run a test query on Smarty Streets, and in my console. So, right here in the console I have an error, and it's specifically an error that says name not resolved. Now if I look over in the Network tab, I go back and I reload my page, and I try this again, I have a failed request, and I can see there's a problem with the auth id. But I'm…

Contents