Log in

View Full Version : Should this work?



Moh
06-09-2008, 04:00 PM
Ok, i'm using javascript to login, heres my codes:


<div id="bth_login">
<form id="bth_login" name="bth_login" action="javascript: bthlogin();" method="post">
<p><strong>Username</strong>:<br>
<input type="text" name="username" id="username" size="20"></p>
<p><strong>Password</strong>:<br>
<input type="password" name="password" id="password" size="20"></p>
<p><input type="submit" value="Submit" name="submit"></p>
</form>
</div>


JavaScript:


function bthlogin()
{
username = document.getElementById('username').value;
password = document.getElementById('password').value;
$('bth_login').innerHTML = '<img src="images/loading.gif" />';
new Ajax.Request('login.php',
{
parameters: {username: username, password: password},
onSuccess: function(send)
{
$('bth_login').innerHTML = send.responseText;
}
});
}


Should that work?

Turbocom
06-09-2008, 04:49 PM
by the looks of your code it should work. Only one way to find out.

Moh
06-09-2008, 04:55 PM
by the looks of your code it should work. Only one way to find out.
Its not working for me :(

Calon
06-09-2008, 04:56 PM
by the looks of your code it should work. Only one way to find out.
He wants to know if it will or not, not somebody thinking they think it should work because they don't even know javascript for a start.

@ Jack:



new Ajax.Request('login.php')

You didn't close the bracket.

Moh
07-09-2008, 03:23 PM
He wants to know if it will or not, not somebody thinking they think it should work because they don't even know javascript for a start.

@ Jack:



new Ajax.Request('login.php')
You didn't close the bracket.
Its suppose to be like that :P
The close bracket is further down.

I found the problem, I forgot Ajax.Request was to do with prototype xD

So its working now :)

Turbocom
07-09-2008, 04:49 PM
He wants to know if it will or not, not somebody thinking they think it should work because they don't even know javascript for a start.

@ Jack:



new Ajax.Request('login.php')

You didn't close the bracket.
Calon now I know why more and more people dislike you. -.-

L?KE
08-09-2008, 04:02 PM
Yeah agreed, unnecessary post.

You got it wrong too... :rolleyes:

Want to hide these adverts? Register an account for free!