you’re on your way 4
287
post requests
form
div
p
Order conrmation
p
div
p
Order conrmation
p
At the end of this
process, here’s what the
DOM tree should look like.
The <p> with the order
conrmation is now all
that the customer sees.
We need to replace the <form>
element from the DOM tree...
...and add the <p>
in the place of the
<form> element.
<div>
<p>
<div>
<form>
Here’s the <form>
we want to replace
with an order
conrmation.
Let’s take a closer look at exactly what happens
when you replace an element in the DOM:
The DOM is connected to what a customer sees
Here’s the part of the DOM
tree that we’re working on.
Here’s what’s going on in the browser
as we change the DOM tree.
This won’t show up in the web
browser until you’ve added it
in to the DOM tree.
Now the <form> is nowhere
to be seen. Perfect!
When the <p> replaced the
<form> in the DOM tree,
the browser updated the
web page to match.
Here’s the DOM tree after you’ve replaced the
<form> element with the new <p> element...
All of this happens without page
reloads... and no waiting around!