jestem świeżak, od razu ostrzegam

Chciałbym stworzyć logowanie z wykorzystaniem advAJAX, które nie przeładowywało by strony.
Mój plik HTML:
<page contentType="text/html" page pageEncoding="UTF-8"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" /> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body onLoad="zaloguj"> <div id="ramka"> ... <br /> <form id="loginForm" method="post" action="login.php"> <div class="loginForm" id="inputLogin"> <input id="username" type="text" size="10" /> </div> <div class="loginForm" id="inputHaslo"> <input id="password" type="password" size="10" /> <img src="./grafika/help.ico" onMouseOver="document.getElementById('password').type='text'" onMouseOut="document.getElementById('password').type='password'"> </div><!--inputHaslo--> <div id="buttonZaloguj" align="right"> <input id="eee" type="submit" value="Zaloguj" class="przyciski"/> </div><!--buttonZaloguj--> </form> ... </div><!--ramka--> </body> </html>
logowanie.js :
Kod
function zaloguj(){
advAJAX.assign(document.getElementById("loginForm"), {
onInitialization : function(obj) {
obj.parameters["password"] = (obj.parameters["password"]);
document.getElementById("eee").value = "Prosze czekac...";
document.getElementById("log").innerHTML = "username: " + obj.parameters["username"] +
"<br />password: " + obj.parameters["password"];
},
onComplete : function() {
document.getElementById("eee").value = "OK";
},
onSuccess : function(obj) {
alert(obj.responseText);
if (obj.responseText == "1")
document.getElementById("log").innerHTML = "ZALOGOWANY";
else {
alert("Nieprawidlowa nazwa uzytkownika lub haslo.");
document.getElementById("password").value = "";
window.setTimeout("document.getElementById('password').focus();", 100);
}
},
onError : function(obj) {
alert("Nie mozna nawiazac polaczenia z serwerem, spróbuj pózniej.");
}
});
}
advAJAX.assign(document.getElementById("loginForm"), {
onInitialization : function(obj) {
obj.parameters["password"] = (obj.parameters["password"]);
document.getElementById("eee").value = "Prosze czekac...";
document.getElementById("log").innerHTML = "username: " + obj.parameters["username"] +
"<br />password: " + obj.parameters["password"];
},
onComplete : function() {
document.getElementById("eee").value = "OK";
},
onSuccess : function(obj) {
alert(obj.responseText);
if (obj.responseText == "1")
document.getElementById("log").innerHTML = "ZALOGOWANY";
else {
alert("Nieprawidlowa nazwa uzytkownika lub haslo.");
document.getElementById("password").value = "";
window.setTimeout("document.getElementById('password').focus();", 100);
}
},
onError : function(obj) {
alert("Nie mozna nawiazac polaczenia z serwerem, spróbuj pózniej.");
}
});
}
<?php $login = $_POST['username']; $haslo = $_POST['password']; if(($login == "poprawny")){ } else{ } ?>
Na razie chciałem sprawdzać chociaż login czy wpisano: poprawny
Za każdą krytykę na temat jestem oczywiście otwarty

/btw podziękowania do kossy za już naniesione poprawki
