Google


ADBRITE ads links
You are here: CodeIdol.com > Ajax > Head Rush Ajax > Making Ajax Requests Speaking The Language > On To The JavaScript

SAVE
Digg
Shown on del.icio.us del.icio.us
See Whos Talking About This on Technorati Technorati
I've Reddit reddit

2.11. On to the JavaScript

Now you're ready to dig into some JavaScript. You know the name of the function that you'll be using to get the customer's phone number: getCustomerInfo(). This function needs to send the customer's phone number to Break Neck's server, and ask for that customer's address.

Let's start out with just the function name:

    function getCustomerInfo()
    ...Here's where all your code will go.
    }The first thing we need to do is get the customer's phone number from the HTML form.

BRAIN POWER

Do you think there could be any problems with event handlers that run JavaScript code that then makes asynchronous requests? What would happen if the pizza form sent a request for an address, and then sent another request before the first response was returned? What do you think the customer would see happen on the order form?


Just Do It

Open up the examples for Head Rush Ajax that you downloaded from http://www.headfirstlabs.com. Go into the chapter02/breakneck/ folder, and you'll find pizza.html. This is the Break Neck order form, but you need to make some changes to bring it up to speed.

First, make sure the HTML matches the answers from the Code Magnets exercise, on page 80. Next, you need to add <script> tags to the <head> section of the HTML, just like you did for the Boards app back in Chapter 1. Finally, go ahead and enter in the empty getCustomerInfo() function. We'll be filling this function in over the next several pages.

Be sure not to go on to the next page until you've got your version of pizza.html updated.



SAVE
Digg
Shown on del.icio.us del.icio.us
See Whos Talking About This on Technorati Technorati
I've Reddit reddit

You are here: CodeIdol.com > Ajax > Head Rush Ajax > Making Ajax Requests Speaking The Language > On To The JavaScript
   
Related tags







Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......






© CodeIdol Labs, 2007