Created
April 27, 2011 23:08
-
-
Save jhowarth/945439 to your computer and use it in GitHub Desktop.
How to post data to create a new Devise session through ajax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function login() { | |
var email = $('#user_email').val(); | |
var password = $('#user_password').val(); | |
var data = {remote: true, commit: "Sign in", utf8: "✓", | |
user: {remember_me: 1, password: password, email: email}}; | |
$.post('/users/sign_in.json', data, function(resp) { | |
if(resp.success) { | |
// process success case | |
} else { | |
// let the user know they failed authentication | |
} | |
}); | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi
Thanks for this example in how to use devise sessions with json, but i have a doubt...
Here did i put my _login.html.haml (how can I call this view ?)
Thanks