Ciao a tutti/e,
passo da form login e password alla pagina check.php per essere valutati:
Codice PHP:
$("#login_form").live("click", function(){
var login = $("#login").val();
var password = $("#password").val();
$.ajax({
type: "POST",
url: "functions/check.php",
cache: false,
data: { login: login, password: password },
success: onLogin
});
});
function onLogin(data) {
if(data!="yes") {
$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
{
//add message and change the class of the box and start fading
$(this).html('Logging in.....').addClass('success large"').fadeTo(900,1,
function()
{
//redirect to secure page
document.location = 'dashboard.php';
});
});
} else {
$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
{
//add message and change the class of the box and start fading
$(this).html('Wrong username or password!').addClass('fail large').fadeTo(900,1);
});
}
}
Mi ritorna data==yes, se il login č giusto e dovrebbe farmi il redirect su dashboard.php.
Invece pur restituendomi yes non me lo valuta correttamente e passa all'else non facendo dunque il redirect. Pechč??