Wednesday, August 10th, 2005

Ajax Toolbox

Category: Toolkit

Ajax Toolbox has released another wrapper on top of XHR that encapsulates the details allowing you to just:

AjaxRequest.get({‘onSuccess’:function(req){ document.forms[0].pageSource.value = req.responseText; } });

You can view the source

And, there is a JavaScript Toolbox too.

Posted by Dion Almaer at 10:34 am
2 Comments

++---
2.8 rating from 6 votes

2 Comments »

Comments feed

I’m not sure how this is useful or new. You can do exactly the same thing with other (better tested) toolkits. Here’s the exact same example in Dojo:

dojo.io.bind({
url: “omitted.in.quoted.example.cgi”,
mimetype:”plain/text”,
load: function(type, data){
document.forms[0].pageSource.value = data;
}
});

Or in Prototype:

Ajax.request(“omitted.in.quoted.example.cgi”, {
onComplete: function(req){
document.forms[0].pageSource.value = req.responseText;
}
});

Note that the Prototype version won’t handle a server-sent error correctly, but it’s just a direct translation and the quoted example won’t either.

Also, I can’t seem to get any kind of source code formatting working on this blog. Ugg.

Comment by Alex Russell — August 10, 2005

or MochiKit:

doSimpleXMLHttpRequest(“omitted.in.quoted.example.cgi”).addCallback(function (req) { document.forms[0].pageSource.value = req.responseText; });

Anything that wraps XMLHttpRequest should be able to do this trivial example in one line of code…

Comment by Bob Ippolito — August 10, 2005

Leave a comment

You must be logged in to post a comment.