Google


ADBRITE ads links
You are here: CodeIdol.com > Ajax > Head Rush Ajax > She Blinded Me With Asynchronous > What JavaScript Do We Still Need To Write

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

3.16. What JavaScript do we still need to write?

There's a lot of JavaScript that you'll need to write to make the coffee maker work like it's supposed to. Let's take a look at all the functions we've got to code, and review what we still need to do:

JavaScript code

You'll need some JavaScript, including:

  • Code to create a request object.

    This code is done, and in ajax.js. It's the same code that we used in Chapter 2, and creates the request object in static JavaScript.

  • A function to send an order to the coffee-making script.

    We can get the user's order, but still need to check the status of the coffee makers and figure out which one to send the order to.

  • A function to serve a drink when it's been brewed.

    We still have to write this function. It needs to get the server's response, and set the status of the coffee maker that just finished brewing back to "Idle".

  • An event handler to connect the "Order Coffee" button to these JavaScript functions.

    We've got this done also. When someone clicks "Order Coffee", our orderCoffee() function runs.

<html>
<head>
<title>Break Neck Pizza Delivery</title>
<link rel="stylesheet" type="text/css" href="breakneck.css" />
<script language="javascript" type="text/javascript">
var request = null;
function createRequest() {
try {
request = new XMLHttpRequest();
} catch (trymicrosoft) {
try {
request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (othermicrosoft) {
You'll need some JavaScript, including:
JavaScript code
JavaScript
orderCoffee()
serveDrink()

* Don't forget, we've still got to get a coffee-making script running on the server, too. We'll get to that in a little bit.


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 > She Blinded Me With Asynchronous > What JavaScript Do We Still Need To Write
   
Related tags







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






© CodeIdol Labs, 2007