[geeklog-devel] AJAX and Javascript Libraries - request for comments

Blaine Lang devel at portalparts.com
Tue Feb 3 14:45:44 EST 2009

Hi Mark,

Sack is not much different then my original code and library I created a 
couple years ago which use the Sarissa library to encapsulate the 
cross-browser XML API's. I agree, that it is small but also is not as 
flexible or efficient to code as the other more mature libraries.

Have a look at this piece of javascript below that uses YUI and hooked 
to the submit button on a form.
No need to setup what fields to send to the AJAX Server script and this 
piece of code also updates the on-page content with the returning 
formatted HTML - all parsed by the PHP server site script from 
templates. This form could have also included file attachments and no 
extra Javascript code. I think this code example is quite easy to read, 
hides all the complexity but is very flexible.

Projects often start small but then grow and get more complex in ways we 
had not initially considered. A plugin that I am currently working on 
now has about 1200 lines of javascript and much of that is AJAX related 
functions. I have high confidence that my code will work across browsers 
and that's worth a few extra KB on initial download.

function makeAJAXUpdateFolderPerms(formObject) {
    YAHOO.util.Connect.setForm(formObject, false);
    var callback = {
        success: function(o) {
            var json = 
o.responseText.lastIndexOf('}') + 1);
            var oResults = eval('(' + json + ')');
            if (oResults.retcode == 200) {
                Dom.get('folderperms_content').innerHTML = oResults.html;
            } else {
                alert('Error retrieving folder permissions');
        failure: function(o) {
            alert('AJAX Update Error: ' + o.status);
        argument: {},
    YAHOO.util.Connect.asyncRequest('POST', ajax_post_handler_url, 

Mark Howard wrote:
> Hey Blaine -
> I know I'm in the 'cheap seats', but I thought I'd share with you - I like
> simplicity/modularity, and don't always like to have to load something as
> big as Scriptaculous/MooTools, etc., and so when I just want to do some
> simple/straightforward Ajax I use SACK, which is the Ajax lib that Wordpress
> happens to use.
> It's very small, lightweight, and the code is mature and of course in use in
> about a million Wordpress blogs everwhere ...
> http://www.twilightuniverse.com/projects/sack/
> Best regards.
> -m
> -----Original Message-----
> From: geeklog-devel-bounces at lists.geeklog.net
> [mailto:geeklog-devel-bounces at lists.geeklog.net] On Behalf Of Blaine Lang
> Sent: Monday, February 02, 2009 7:18 PM
> To: Geeklog Development
> Subject: [geeklog-devel] AJAX and Javascript Libraries - request for
> comments
> Dirk is in the process of moving the Wiki and had been waiting to start 
> this on the Wiki but in light of some recent other discussions, I will 
> start that discussion here on the DEV list. For some time (ok, a couple 
> years), I have wanted to add a more comprehensive Javascript library 
> with AJAX capabilities to the core GL framework.
> Although, the initial focus is on adding a JS libray to make it easier 
> to add AJAX, there is clearly a need for a JS library to made it easier 
> to code the functions and UI components to handle and enrich the user 
> interface. AJAX enabled forms or screens can all be coded in plan 
> Javascript but the optimizations and proven library functions can not 
> only make the coding easier, faster and cleaner but we easier to develop 
> common methods and reference code. Thats without leveraging some of the 
> sophisticated widgets, plugins these libraries can offer.
> This thread is then to ask for suggestions on the JS Library to use and 
> why. We may need to setup prototyped code for comparison.
> I will start with my preference and reasons - let the debate begin ....
> ------
> As part of our Nextide projects, we have been doing AJAX powered Geeklog 
> plugins for a few years. Many of the nexpro plugins like nexFlow, 
> nexList are good examples but that code was done a few years ago. Since 
> then we have further optimized the coding style of using YUI and our 
> latest projects (not public releases) are much cleaner.
> There are probably 100 AJAX libraries that could work with PHP and I 
> started into this a few years ago rolling my own to better understand 
> the issues. After looking at and trying a few, I settled on YUI because 
> about 2+ years ago, it was developing a strong community and had a big 
> name behind it. JQuery and others like qooxdoo,MooTools, Prototype,Dojo 
> where also starting out.
> YUI's AJAX has some nice features like automatic linking to a target 
> form and posting the form fields with no additional Javascript and can 
> easily handle files. The library supports both POST and GET and easily 
> used in non-form applications like links where you still want to use 
> AJAX. The library has configurable timeout plus support for success and 
> error handlers as well as custom event handlers. I've been using it with 
> the YUI JSON library this past few months and it's been working nicely 
> and easy to code.
> The YUI library is quite extensive now, but we only need to use 
> Connection Manager Library which needs the minimum version of 
> theirYahoo-Core and Event libraries. Additionally, they have the JSON 
> library which is optional but highly recommended that we standardize on 
> with any AJAX returning data.
> http://developer.yahoo.com/yui - main site, with links to their blog, 
> examples, documentation and community forum.
> http://developer.yahoo.com/yui/connection/  - the AJAX connection library
> YUI has a very complete documented API, plus examples, tutorials and 
> active development community.
> YUI 3.0 is in Pre-Release and shows that this library has a forward 
> looking roadmap.
> http://developer.yahoo.com/yui/3/
> Using YUI and JQuery for some of JQuery's nice UI and DOM manipulation 
> is very doable and I have recently started to use JQuery for a new 
> project. I really like the way JQuery has fostered active development 
> and extensions and don't see any reason why we can't use both JQuery and 
> YUI where they fit best. In both cases, minified and CDN hosted 
> libraries are available.
> - Blaine
> _______________________________________________
> geeklog-devel mailing list
> geeklog-devel at lists.geeklog.net
> http://eight.pairlist.net/mailman/listinfo/geeklog-devel
> _______________________________________________
> geeklog-devel mailing list
> geeklog-devel at lists.geeklog.net
> http://eight.pairlist.net/mailman/listinfo/geeklog-devel

More information about the geeklog-devel mailing list