Skip to content

Instantly share code, notes, and snippets.

@jhowarth
Created April 27, 2011 23:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhowarth/945439 to your computer and use it in GitHub Desktop.
Save jhowarth/945439 to your computer and use it in GitHub Desktop.
How to post data to create a new Devise session through ajax
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;
}
@felipe3246
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment