diTii.com Digital News Hub

Sign up with your email address to be the first to know about latest news and more.

I agree to have my personal information transfered to MailChimp (more information)

May262006

Clean AJAX Implementation, Simply Clean !

clean-ajax.pngClean AJAX is an open source engine for Asynchronous JavaScript with XML that, in few words, is a technology that can be used to perform asynchronous HTTP requests programatically. The main purposes of this project are:

  • Provide an AJAX engine that could be used to improve web applications and make then even better;
  • Provide an AJAX engine easy to use, easy to integrate with any project and self contained (that doesn’t require anything else to work);
  • Popularize Rich Internet Applications based on open standards (What the Web should be!).

A Simple usage of Clean AJAX :


/**
* Perform AJAX HTTP get
*/
function ajax_get(url, elementId, win){
message = new Message();
message.method = "GET";
message.address = url;
message.document = win.document;
message.consumer = elementId;
message.onError = showError;
wait(elementId, win.document);
Connection.sendMessage(message);
}

/**
* Show AJAX error messages
*/
function showError(e){
alert(e);
}

/**
* Apply HTML code on destination element to show response's progress
*/
var waitImage = new Image();
waitImage.src = "";

function wait(elementId, doc){
di = new DomIterator(doc);
html = "

";
di.applyValue(elementId, html);
}

Share This Story, Choose Your Platform!

Do NOT follow this link or you will be banned from the site!