Problems with XMLHttpRequest.send in Firefox 3
"A.M." <[email protected]> Mon, 21 Jul 2008 06:52:44 -0700 (PDT)
| Newsgroups | gmane.comp.mozilla.internationalization |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
With the 3.0 version, I've been having some problems with a javascript
function. This code worked just fine in Firefox 2.0, and still works
fine in Internet Explorer. Any thoughts?
Here's the script
--------------------------------------
function login(uname, pwd) {
var objHTTP;
if (window.ActiveXObject) {
objHTTP = new ActiveXObject('Microsoft.XMLHTTP');
}
else {
objHTTP = new XMLHttpRequest();
}
objHTTP.open('POST',"/cgi-bin/UserLogin.cgi",false);
objHTTP.setRequestHeader('Content-Type', 'application/x-www-form-
urlencoded');
objHTTP.send("un=" + uname + "&pw=" + pwd);
var strResult = objHTTP.responseText;
var regexp = /url="(.*)">/;
var url = regexp.exec(strResult)[1];
window.open('/cgi-bin/' + url);
}
It chokes at the line "var strResult = objHTTP.responseText;" because
it seems that the previous line did not correctly send the username
and password. Does anyone have an idea about why this is happening? I
thought about the encoding problem that was discussed last month here,
but I don't think that's the problem.