Print

Print


If you're looking at the cvs repository, check out RemoteRequest.js in particular.  It's an XMLHTTPRequest wrapper class that manages requests and does some behind the scenes magic.

An example:

var req = new RemoteRequest(service, method, param1, param2, ...);
req.setCompleteCallback(
   function(request) {
      var obj = request.getResultObject();
      alert("The internet gave me an object => " + obj.blah());
   }
);
req.send();


This fires off an asynchronous xmlhttp request with a specially crafted url.  Apache handles the request and any data returned is run through a JSON parser and turned into a javascript object.  The object can then be retrieved from within the anonymous callback.

This has worked well for us and basically just requires the XMLHTTPRequest wrapper class, a hand tuned JSON parser (in ILS/OpenSRF/src/javascript), and an Apache module that can turn the request into something meaningful for your framework.

-bill


-----Original Message-----
From:   Code for Libraries on behalf of Peter Murray
Sent:   Fri 6/10/2005 1:00 PM
To:     [log in to unmask]
Cc:
Subject:        SPAM: Re: [CODE4LIB] ajax

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mike --

It is kinda hard to visualize, although I'd really like to try.  Is
there a demo available somewhere?


Peter

On 6/10/05 12:22 PM, Mike Rylander wrote:
| <promotion type="shameless">
|
| If anyone feels like digging into an app that's extremely heavy with
| XMLHttpRequest stuff you may want to look at Evergreen, a.k.a
| Open-ILS.  The entire staff client, which is written in XUL, and the
| current version of the OPAC are entirely "ajax" driven.  We use it to
| connect, via an Apache module, to our back end cluster.
|
| http://open-ils.org/cgi-bin/viewcvs.cgi/ILS/Open-ILS/src/javascript/util/
|
| </promotion>


- --
Peter Murray                       http://www.pandc.org/peter/work/
Assistant Director, Multimedia Systems  tel:+1-614-728-3600;ext=338
OhioLINK: the Ohio Library and Information Network   Columbus, Ohio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCqcdF4+t4qSfPIHIRAt6kAKC2jTtS809gCMB6XzQqMmb3/jaJqgCdGuKV
lms5p1f8w/5YN6txjjlMKc4=
=NyBM
-----END PGP SIGNATURE-----