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: Modify the DOM

Solution: Modify the DOM - JavaScript Tutorial

From the course: JavaScript: Ajax and Fetch

Start my 1-month free trial

Solution: Modify the DOM

(upbeat electronic music) - [Narrator] To get the part data into the dom, the first thing I need is references to a couple more dom elements, and we've done this before. So, after parkSection, I'm going to create a new const called parkName, and that's going to be document.querySelector, and it's going to be #specials h2 a. And then we also need one for the description, so I'm going to call this parkDesc. That's going to be document.querySelector, and that's just #specials, space, p. And then, in the parkUpdateUISuccess function, I want to parse data variable, storing the parsed version of the data. So I will start with a const parsedData. And that's JSON.parse data. And then we'll change our console.log to parseData. And so, just saving this, starting my viewer, checking out the console, and after a moment, I should get a response. And there we go. And so now I can see the data, which is an object, and if I start digging in, I can see that object has this property that has a lot more…

Contents