Моя форма входа
Код: Выделить всё
[i]
Username
Password
Submit
[/i]
Код: Выделить всё
$(document).ready(function() {
$('#loginBtn').click(function() {
var username=$("#username").val();
var password=$("#password").val();
var dataString = 'username='+username+'&password='+password;
if($.trim(username).length>0 && $.trim(password).length>0) {
$.ajax({
type: "POST",
url: "login.php",
data: dataString,
cache: false,
beforeSend: function(){ $("#loginBtn").val('Connecting...');},
success: function(data){
if(data) {
window.location.href = "application.php";
} else {
$('#loginCard').shake(); //Shake animation effect.
$("#error").html("Error: Invalid username and password. ");
}
}
});
}
return false;
});
});
Код: Выделить всё
Подробнее здесь: [url]https://stackoverflow.com/questions/27534621/jquery-ajax-php-login-form[/url]