Treating Ajax as an “all or nothing” technology.
It will take a lot of time and effort to create a “separate but equal” non-Ajax version.
Progressive Enhancement
Gotta keep 'em separated
<p style="font-weight: bold">This is an introductory paragraph.</p>
<p class="introduction">This is an introductory paragraph.</p>
p.introduction { font-weight: bold; }
<a href="javascript:window.open('help.html')">contextual help</a>
<a href="#" onclick="window.open('help.html'); return false;">contextual help</a>
<a href="help.html"
onclick="window.open(this.getAttribute('href')); return false;">contextual help</a>
<a href="help.html" class="help">contextual help</a>
function doPopups() {
if (document.getElementsByTagName) {
var links = document.getElementsByTagName("a");
for (var i=0; i < links.length; i++) {
if (links[i].className.match("help")) {
links[i].onclick = function() {
window.open(this.getAttribute("href"));
return false;
};
}
}
}
}
Avoid:
<a href="#">
<a href="javascript:">
“But it's a whole different paradigm — the old rules don't apply.”
“But it's not a website anymore — it's more like a desktop application.”
“It must degrade well. It must still be accessible. It must be usable. If not, it is a cool useless piece of rubbish for some or many people.”
XMLHttpRequest
instead of the server.Back-end architecture should be modular.
Web pages are created by joining modules together (e.g. navigation, log-in form, shopping cart, etc.)
[Hint: APIs are very modular]
A page that includes a form: when the form is submitted, the same page is returned with just part of the page updated.
Example: Contact form (JS)
Clicking on a link returns the same page but with one portion changed (different data or different view of data).
Example: Shopping cart (JS)
eval()
innerHTML
So simple, it's a microformat: AHAH
Use the XMLHttpRequest object like a dumb waiter:
Client-side processing is kept to a minimum: all the heavy lifting happens on the server.
Example: Sorting tables (JS)