AHAH(Asynchronous HTML over HTTP)

from:http://www.openjs.com/articles/ajax/ahah_asynchronous_html_over_http/

 

AHAH or Asynchronous HTML over HTTP is a much simpler version of AJAX. Using AHAH approach in JavaScript you can display external XHTML pages inside your HTML page. The beauty of the script is that it is very simple - the underling code is just twenty lines!

The difference between AJAX and AHAH is the return data fomat. AJAX will load an XML file - then the developer will have to make the code that will parse the XML, extract the data and then display the results. In AHAH the approach is much simpler - the data to be fetched is XHTML - the code just has to fetch it - as the browser is already equipped to handle HTML and will display the result with no further help from the developer.

Use

For example, lets say we need to create a page with tabs - each tab will put some content in the main area - but the full thing must be dynamic - linking to another page won't do. The code of the main page will be...

 

 

The point of our exercise will be to load the contents of the javascript.html in to the div with the id 'content'. In the JavaScript section of the file we will declare the 'load' function...

 

 

The code of the ahah.js file as given below...

 

 

 

 

Now the only file left is the three content files - javascript.html, ahah.html and ajax.html. The important thing to remember about this is that you should not include the standard HTML stuff like <html><body> etc. in this page - just the content with all the HTML formatting - I am just providing the code for just the file javascript.html here - remember that this is the whole file - nothing other than the shown data must be in that file.

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值