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

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

2007-11-29 Thread Godmar Back
You're using IE, which means you need to issue the open() before adding the onreadystatechange handler. Otherwise, open will trigger a call to your handler, and IE's implementation won't have reset the readyState to 0. In either event, you should double-check that the status of the request is 200

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

2007-11-29 Thread Ewout Van Troostenberghe
To point out why the use of a Javascript framework is important, let me put your code into jQuery (http://jquery.com) $.get('index.cgi', {cmd:'add_tag', username:'username'}, function(html) { // do whatever you want here }) PrototypeJS has a similar, easy to use construct. In the end, using

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

2007-11-29 Thread Andrew Nagy
Eric - Have a look at some of the ajax functions I wronte for VuFind - there are some almost identical function calls that work just fine. http://vufind.svn.sourceforge.net/viewvc/*checkout*/vufind/web/services/Record/ajax.js?revision=106 See function SaveTag Also - You might want to consider

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

2007-11-29 Thread Keith Jenkins
jQuery++ I like to do things from scratch, but have never regretted moving to jQuery. Whatever time it takes you to check it out will be paid back a thousand times, at least. Keith On 11/29/07, Ewout Van Troostenberghe [EMAIL PROTECTED] wrote: To point out why the use of a Javascript

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

2007-11-29 Thread Andrew Nagy
Subject: Re: [CODE4LIB] httpRequest javascript grrr These days I think jquery seems more generally popular than prototype. But both are options. I definitely would use one or the other, instead of doing it myself from scratch. They take care of a lot of weird cross-browser-compatibility stuff

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

2007-11-29 Thread pkeane
I'd highly recommend getting a good clear handle on the underlying javascript workings before moving to a library like jQuery (which I am quite fond of) especially when using XMLHTTPRequest. If you don't, mysterious problems may arise that are all the more difficult to debug since you have the

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

2007-11-29 Thread Eric Lease Morgan
On Nov 29, 2007, at 9:21 AM, Eric Lease Morgan wrote: Why doesn't my httpRequest Javascript function return unless I add an alert? Grrr. I have resolved my problem, but I'm not exactly sure how. First of all, my httpRequest (XMLHttpRequest) code was just fine. I made no significant changes

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

2007-11-29 Thread pkeane
Indeed, my proposed fix was incorrect -- an alert does NOT need to be passed into the function as a callback (it's always globally available) and since the parameter for the alert is response text, that's A-OK. If you want to insert that response into the page (and not just 'alert' it), you