Wednesday, August 3rd, 2005

Ajaxian QDF Interfaces

Category: Articles

Josh Reed has written a piece in which he gives “you an idea of some of the things that can be accomplished via AJAX to create highly interactive interfaces”.

He goes into detail on how he wrote Ajaxian QDF Interfaces:

For the QDF interfaces, I needed to composite content from multiple locations into a single, interactive interface. Since I wasn’t calling any Java code, I ruled out DWR. And because my content was going to be mixed HTML, text, images, I ruled out Sarissa. Ultimately I decided on Dojo. I used Prototype first, with much success, but I encountered some compatability issues that I didn’t have with Dojo.

Code Sample

/*
 *    Loads content from a URL and puts it into a container element.  If an error occurs, the loadError message is put into the
 *    container instead.  You can also customize the messages by creating two variables called loadMsg and loadError.  If you
 *    pass true for execute, inline scripts in the remote content will be executed.
 *
 *    Example:
 *    loadRemoteContent(getElementById('some-div'), 'content.html', true);
 */
function loadRemoteContent(container, url, execute) {
    loadContent(container, ((loadMsg) ? loadMsg : ''));
    try {
        dojo.io.bind({
            url:      url,
            load:     function(type, data, evt) { loadContent(container, ((execute) ? executeScripts(data) : data)); },
            error:    function(type, error) { loadContent(container, ((loadError) ? loadError : '')); },
            mimetype: "text/plain"
        });
    } catch (e) {
        loadContent(container, ((loadError) ? loadError : ''));
    }
}

Posted by Dion Almaer at 12:04 am
Comment here

+++--
3 rating from 5 votes

Comments Here »

Comments feed

Leave a comment

You must be logged in to post a comment.