View Full Version : Using Login with XMLHttpRequest

Nov 6th, 2006, 04:25 PM
I'm fairly new using XMLHttpRequest but I've been able to utilize it very effectively when requesting a stream from an open (no authentication required) page. Unfortunately I'm not able to get it working for anything when I'm requesting a element or data from a website requiring authentication. Has anyone here used this object to pull secure data passing the username and password with it? Is there something special that needs to be setup on the site to allow this?

From what I gather, according to the object's specs it states that something like this below should work:

var xhReq = createXMLHttpRequest()
xhReq.open("GET", urlToLoad, true, "RBrenn", "passwordxxx")

All I get is the login page, not the page I'd originally requested and somehow it doesn't send the login information. Does anyone out there have an effective example on how to log into a page requiring authentication so it will redirect me to the source? Any examples are very welcome. I've looked around on the web a lot but haven't found anything that works.

The other situation I'm facing that's related to XMLHttpRequest is this:

I'm trying to pull some data from another web based program. I need it to let me login but if I request a page that has data on it requiring authentication all I get is a blank page, it doesn't prompt me for authentication. Below is the URL:


If you actually go to the login page and log in...

Username: RBrenn
Password: passwordxxx

...you can then use the first URL to view the data that is stored there.

Does anyone know why it will serve me a blank page instead of requesting me to login? I've never encountered this before. Perhaps someone else knows the trick behind this.

Any and all help, insight, and swift kicks in the *$% are always welcome. At least with help I can usually get on the right path. Thanks all.

Tim Williams