Re: [CODE4LIB] httpRequest javascript.... grrr

2007-11-29 Thread Jesse Prabawa
Hi Eric,

Have you considered using a Javascript Library to handle these details? I
would recommend that you refactor your code to use one so that you can
concentrate on what you actually want to do instead. This way you can also
avoid having browser incompatabilities that are already solved if you use a
Javascript Library. Try checking out Prototype at

Best regards,


On Nov 29, 2007 10:21 PM, Eric Lease Morgan [EMAIL PROTECTED] wrote:

 Why doesn't my httpRequest Javascript function return unless I add an
 alert? Grrr.

 I am writing my first AJAX-y function called add_tag. This is how it
 is suppose to work:

   1. define a username
   2. create an httpRequest object
   3. define what it is suppose to happen when it gets a response
   4. open a connection to the server
   5. send the request

 When the response it is complete is simply echos the username. I know
 the remote CGI script works because the following URL works correctly:

 My Javascript is below, and it works IF I retain the alert
 ( 'Grrr!' ) line. Once I take the alert out of the picture I get a
 Javascript error xmldoc has no properties. Here's my code:

   function add_tag() {

// define username
var username  = 'fkilgour';

// create an httpRequest
var httpRequest;
if ( window.XMLHttpRequest ) { httpRequest = new XMLHttpRequest(); }
else if ( window.ActiveXObject ) { httpRequest = new ActiveXObject
 ( Microsoft.XMLHTTP ); }

// give the httpRequest some characteristics and send it off
httpRequest.onreadystatechange = function() {

 if ( httpRequest.readyState == 4 ) {

  var xmldoc = httpRequest.responseXML;
  var root_node = xmldoc.getElementsByTagName( 'root' ).item( 0 );
  alert ( );


}; 'GET', './index.cgi?cmd=add_tagusername=' +
 username, true );
httpRequest.send( '' );
alert ( 'Grrr!' );


 What am I doing wrong? Why do I seem to need a pause at the end of my
 add_tag function? I know the anonymous function -- function() -- is
 getting executed because I can insert other httpRequest.readyState
 checks into the function and they return. Grrr.

 Eric Lease Morgan
 University Libraries of Notre Dame

 (574) 631-8604

[CODE4LIB] Rapi: An open-source OPAC package

2008-06-23 Thread Jesse Prabawa

Rapi is an open-source project of the WING group in the School of Computing,
National University of Singapore licensed under the MIT license.

Rapi provides an OPAC package that allows you to:
  1. Build a Lucene index from your MARC files
  2. Screen scrape live circulation data from your own iii OPAC
  3. Wrap your OPAC with a customizable user interface

The user interface packaged with Rapi has been tested with Firefox 2
and 3 as well as Internet Explorer 7. The user interface supports a
variety of features including tabs, an overview+details view, and a
suggestion bar among many others. Note that although the user
interface supports query suggestions, the package currently does not
provide any suggestion modules. With that said, if you do have query
suggestion modules, they can be easily integrated with the package.
As an example, our live demo at
incorporates a spelling suggestion module.

For more information, Rapi is available at

We look forward to your feedback. Thanks,

School of Computing
National University of Singapore