-
Book Overview & Buying
-
Table Of Contents
Learning jQuery : Better Interaction Design and Web Development with Simple JavaScript Techniques
Underneath all the hype and trappings, AJAX is just a means of loading data from the server to the web browser without a visible page refresh. This data can take many forms, and we have many options for what to do with it when it arrives. We’ll see this by performing the same basic task in many ways.
Suppose we have a page that displays entries from a dictionary. The HTML inside the body of the page looks like this:
<div id="dictionary"> </div>
Yes, really! Our page will have no content to begin with. We are going to use jQuery’s various AJAX methods to populate this <div> with dictionary entries.
We’re going to need a way to trigger the loading process, so we’ll add some buttons for our event handlers to latch onto:
<div class="letters">
<div class="letter" id="letter-a">
<h3>A</h3>
<div class="button">Load</div>
</div>
<div class="letter" id="letter-b">
<h3>B</h3>
<...
Change the font size
Change margin width
Change background colour