With some of the basics of customization out of the way, it is time to throw Ajax into the mix. Ajax will allow us to create more complex customizations for the user without requiring a total page refresh with each change in that customization. More work is involved in the approaches that follow, but more work is not necessarily a bad thing.
Any customizations that we would want to make through Ajax
will require us to do some heavy manipulation of the Document Object
Model (DOM) document. Therefore, it is important that our markup is
structured to where we want it and that it is readily identifiable
class attributes. To give an example,
let's say we have two paragraphs on the page, both of which can be
changed through manipulation when there is an Ajax call. The
following would be a bad way to structure this markup:
<p> <!-- first paragraph data --> </p><p> <!-- second paragraph data --> </p>
<div id="myParagraphContainer"> <p id="paraSwitch01" class="switchable"> <!-- first paragraph data --> </p> <p id="paraSwitch02" class="switchable"> <!-- second paragraph data --> </p> </div>
If you know your pages are going to be heavily ...