Session Problem with Ajax Call

selva wrote:


    I am totally new to Ajax. I am trying to use ajax in my project. Its working fine, I am getting problem while session time expires. If session expires means i am redirecting to login page.Onclick i am calling on ajax function. It will goto controller and it will check the session if session expires then it has to goto login page.

Your "session_expired" filter should check if this is an xhr request, if yes a redirection is needed you'll have to send back javascript redirection snippet:

return unless session expired? flash[:notice] = "Your session expired" if request.xhr?   render :update do |page|     page.redirect_to login_path   end else   redirect_to login_path end false

best, zsombor