I'm trying to authenticate through AJAX and can not figure out how to show a message when ajax request is finished. When email and password are invalid, I need to show an error message.
The code of a haml page
=form_for(resource, :as => resource_name, :url => session_path(resource_name), :remote => true, :format => :json) do |f|
= label :user, :email, "Email"
= text_field :user, :email
= label :user, :password
= password_field :user, :password
%input{:type => "submit", :value => "Sign in"}
and the result

Your ideas?