5.7. 4. Write the callback functionNow that the Break Neck PHP script just returns a delivery estimate, we can write a new JavaScript function to display this to the customer. Let's figure out exactly what we need to do. What we have: An HTML page with a main <div>, and a <form> within that <div> for taking orders. Here's the main <div> for the page, with an id of "main-page". The <form> has an id, "order-form", that we can use to look the <form> element up in the DOM. What we want: An HTML page with a main <div>, and an order confirmation within that <div>. This is the same <div> as in the original order form... ...but we've replaced the <form> with a text order confirmation. What we need to do: Replace the <form> in the main <div> with the order confirmation.
form div p Order confirmation p Let's look at this step in a little more detail. |