Hi!
I have problems using httprequest as shown below.
Code:
var request = google.gears.factory.create('beta.httprequest');
var params="auth_user="+username+"&auth_pw="+password;
request.open('POST', '/login.php');
request.setRequestHeader("Content-type","application/x-www-form-
urlencoded");
request.onreadystatechange = function() {
if (request.readyState == 4) {
alert(request.responseText);
}
};
request.send(params);
The login.php returns a text "Logged in" when login is ok (text
echo'ed from login.php) , otherwise some other htmlcode from a
redirect.
I'm trying to send data as POST, but when accessing
request.responseText , the firebug just shows an "internal error". I'm
not to sure if this is the correct way to use POST.
This is only a problem when the redirect is used (not logged in), and
I don't need the responseText from this redirect. I can't change this
redirect easy.
Is there any way to tell if the responseText is valid and won't create
an error?
If I'm refering to responseText to check, the error comes, and halt
the script.