views:

90

answers:

2

Hi everybody, this question might seem stupid, but here's the situation: I'm trying to create an auto login page for my mail using jquery's post request, but it's not working, it works with all other pages except with webmail. So, trying to figure out what was wrong, I recreated the login form, here's the code:

<form id="form1" name="form1" method="post" action="https://login.hostmonster.com/"&gt;
<label>User
<input type="text" name="login" id="user" />
</label>
<label>Pass
<input name="password" type="password" id="pass" />
</label>
<input name="doLogin" type="submit" id="doLogin" value="Login">
</form>

The strange thing is when you change the input type of pass to text, the form doesn't work! I can't figure out why. Anyway, if you can tell me what's the real difference between the input type text and password (and not what it says everywhere on the net that the only difference is that when you type stars appear instead of characters) I would appreciate it. Also, do you think this is affecting my jquery's post? Here's the code for it:

$j.post('https://login.hostmonster.com/', { login: '[email protected]', password: 'xxx' }, function(data, text){
 if (text=='success')
 {
  alert('Success '+data);
  }
  else
  {
    alert('Failed');
  } });

Thanks a lot! Regards,

D

+1  A: 

Another difference aside form the stars is you can't copy (Ctrl+C) the data in a password field.

aslum
A: 

One big problem that I see here is that the response will be stored in the variable data and not test. test is loaded with textStatus which, if I am not mistaken, only tells you whether your request went through. In other words, your script should be validating even with a bad password.

Here are some things to ask yourself, and perhaps let us know. First, is that the only thing that you changed? Does your form work without JavaScript? How does your script set and load the values entered? When you say that "it's not working", what is it not doing? Using a packet sniffer will help you see exactly what is getting sent as well as what is coming back.

Your browser should be interpreting "text" and "password" pretty much the same when it comes to data sent. However, some browsers don't follow the standards. Also, jQuery could be doing something different, but I've never heard of it before.

kainosnous