Online Book Reader

Home Category

HTML, XHTML and CSS All-In-One for Dummies - Andy Harris [315]

By Root 1377 0
” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

multiPass.html

Multi - Pass Demo

Please select a hero for more information...


Setting up the HTML framework

As always, the HTML page provides the central skeleton of the page. This site is reasonably simple, because it sets up some empty areas that will be filled in with AJAX requests later:

1. Import jQuery.

The jQuery library makes AJAX really simple, so begin by importing the library. Check out Chapter 2 of this minibook if you need a refresher on importing jQuery. You can also include the jQuery UI modules if you want, but it isn’t necessary for this simple example.

2. Build a simple form.

The page has a form, but this form is designed more for client-side interaction than server-side. Note that the form has a null action. That’s because the form won’t be directly contacting the PHP program. Let AJAX functions do that.

3. Don’t add a button.

Traditional forms almost always have buttons (either standard buttons in client-side coding or submit buttons for server-side). While you can still include buttons, one of the goals of AJAX is to simplify user interaction. The page will update as soon as the user selects a new hero, so you don’t need a button.

4. Create an empty