Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
ajax login
<form method="post" action="" id="login-form" accept-charset="UTF-8">
<input type="hidden" name="action" value="users/login">
<input type="hidden" name="redirect" value="{{redirect}}">
<div class="form-group">
<label for="email">Email</label>
<input id="email" type="text" name="loginName" class="form-control">
<div class="form-group">
<label for="password">Password</label></h3>
<input id="password" type="password" name="password" class="form-control">
<div class="text-right">
<input type="submit" value="Log In" class="btn btn-primary ">
$('#loginForm').submit( function (e ) {
var data = $(this).serialize();
method: 'POST',
url: '/',
data: data,
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
.success(function(data) {
console.log('success', data);
.error(function(data) {
console.log('error', data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment