you’re on your way 4
279
post requests
Break Neck doesn’t seem to be asking for anything that complicated. Let’s see if we
can convert the Break Neck pizza form submission into an asynchronous request.
Here’s what you’ll need to do:
Submitting a form with Ajax
submitOrder()
showConrmation()
2
4
1
Your new JavaScript function, submitOrder(),
will submit the customer’s order to the
Break Neck server asynchronously, using the
information in the pizza order form.
In this step, you’ll have to write
a new callback function. This
will need to take the delivery
time that you get from the
Break Neck server, and give the
customer a conrmation that her
order is on its way.
First, you’ll need to change the Break Neck
HTML: instead of letting a customer place
her order with a submit button, the “Order
Pizza” button should call a new JavaScript
function. You’ll write this function in the
next step, and call it submitOrder().
Break Neck server
3
You’ll have to make sure the
PHP script on Break Neck’s
server doesn’t send back
HTML anymore... instead, it
should return how much time
it will take for the pizza to
arrive at the customer’s door.