Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Ultra simple Prototype.js AJAX example (See related posts)

Taken from the great Amy Hoy.

<h2>ajax replacing link</h2>
<a href="backend.php?return=time" 
   onclick="new Ajax.Updater('testdiv', 'backend.php?return=time',
   {asynchronous:true, evalScripts:true }); return false;">
This link updates a line</a>
<div id="testdiv"></div>


With no JavaScript turned on, it'll go to the normal URL. Without, it'll do an XMLHTTPRequest and put the result in #testdiv.

Comments on this post

oratico74 posts on Jun 10, 2008 at 17:12
muy bueno.

You need to create an account or log in to post comments to this site.


Click here to browse all 5141 code snippets

Related Posts