« try ruby! (in your browser) | Main | How to make XmlHttpRequest calls to another server in your domain »

AHAH, Asychronous HTML and HTTP

AJAX ? AHAH ! sounds funny, but AHAH now stands for Asychronous HTML and HTTP, a technique for dynamically updating web pages using JavaScript, involving usage of XMLHTTPRequest to retrieve (X)HTML fragments which are then inserted directly into the web page, whence they can be styled using CSS. Nothing new until now, except that inspite of retreiving XML, AHAH stands for retreiving (X)HTML.

AHAH is intended to be a much simpler way to do web development than AJAX : "Asynchronous JavaScript and XML." Strictly speaking, AHAH can be considered a subset of AJAX, since (X)HTML is just a special kind of XML.

The main reasons that made AHAH exists :

  • The lack of custom XML schemas dramatically reduces design time
  • AHAH can trivially reuse existing HTML pages, avoiding the need for a custom web service
  • All data transport is done via browser-friendly HTML, easing debugging and testing
  • The HTML is designed to be directly embedded in the page's DOM, eliminating the need for parsing
  • As HTML, designers can format it using CSS, rather than programmers having to do XSLT transforms
  • Processing is all done on the server, so the client-side programming is essentiall nil (moving opaque bits)

This is a sample code for sending an AHAH request


function ahah(url,target) {
// native XMLHttpRequest object
document.getElementById(target).innerHTML = 'sending...';
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = function() {ahahDone(target);};
req.open("GET", url, true);
req.send(null);
// IE/Windows ActiveX version
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = function() {ahahDone(target);};
req.open("GET", url, true);
req.send();
}
}
}

Then to receive an AHAH request


function ahahDone(target) {
// only if req is "loaded"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
results = req.responseText;
document.getElementById(target).innerHTML = results;
} else {
document.getElementById(target).innerHTML="ahah error:n" +
req.statusText;
}
}
}

I have added a new category for AHAH, also called JAH, for Just Asynchronous HTML, which was introduced on May 12, 2005 by Kevin Marks. The term "AHAH" was proposed by Ernest Prabhakar during the 2005 Web 2.0 conference, and later adopted as part of the REST-Enabled XHTML microformat for web services. AHAH, now I understand better, did you ?

Source Microformats

Bookmark this article at these sites
Comments
1

Hi guys, I want to inform you, that I have developed a Degradable liveSearch in AHAH. It works with and without javascript enabled. Please visit it to :

Degradable liveSearch (http://www.gizax.it/experiments/AHAH/degradabile/test/liveSearch.html)

regards

Daniele

2

AHAH looks like a quick and easy method for updating small webpage areas. Just for fun, I used it for the "total visits" counter here: http://www.greg.ch/flash (open a site and watch the number of visits change).

3

You've got to be fucking kidding right?

What's next? A subset of AJAX that updates CSS? ACAH? sigh...

PS: Great articles here, but this one...

4

Hi guys,

I'd like to show you my new experimental project:

AHAH section

[1]. http://www.gizax.it/ahahsection/

5

First, I tought it was a joke, but I realized that none of my application uses XML. I like the approach of AHAH for simple app. It's light, no bloated prototype or other lib which I don't need some fancy thing. Below is my AHAH creation. This page is all AHAH.
http://www.ex-designz.net/englishlyrics/default.asp

Dexter
www.ex-designz.net

6

OutPost is an AHAH/Hijax framework.

See demo here: http://hijax.net/Demo

7

OutPost is an AHAH/Hijax Framework.

Try the demo: http://hijax.net/Demo

8

Hi gays,

I am created very powerfull AHAH library

Advantages:
1) multithread
2) full support GET and POST request
3) separate history for each thread (for loading of a web pages)
4) parsing and execution of script, link and style tags from loaded content
5) upload file without reload
6) preprocessor data response
7) history for "Back" & "Forward" buttons
8) direct link for AJAX request of HTML
9) auto-filter of anchors - automatic trasformation to AJAX
10) content trigger
11) TITLE processing
12) trap for document.write for every thread
13) accelerate download of scripts - parallel download with serial apply
14) list of support counters : Google Analytics, Rating@Mail.ru, and other
15) support event onload & onunload of tag for every thread
16) Opera bug fixed where setTimeout & setInterval in use Back/Forward AJAX history - by David Bloom (futuramagmail.com, add a "@" before gmail.com)
17) two models request of HTML pages - one-to-one & one-to-many
18) on & off option for correction relative path (href & src)
19) capture & execute window.onload event
20) FLY AJAX - transformation of content to AJAX on fly

AHAH - more powefull & more difficult than only AJAX

9

This is link for previous post

http://www.fullajax.ru

10

Great si-ru - but it's all in Russian. Useless. Any plans on writing your information in English??

11

Necesito ayuda para ver los demos de las librerías que sirven para Ajax. Alguien me puede ayudar
Gracias

Post a comment





(Email will remain hidden)





Please enter the security code you see here




Related entries
Email to a friend
Email this article to:


Your email address:


Message (optional):