Ajax question about refreshing divs

Ok, I have manny divs in the html, and I have a login form in a inner
div, if the user tries to login and the user/password is invalid, only
the inner div needs to be refreshed and show the user the error. If the
user/password is ok, the main div needs to be refreshed.

How could I do this?

this is the view in example


<%= form_tag :action => "login" %>

  <%= text_field "user", "username", "size" => "20", "class" =>

“Textos-02” %>

  <%= text_field "user", "password", "size" => "20", "class" =>

“Textos-02” %>

  <%= image_submit_tag "bot-ok.gif" %>

<% end_form_tag %>

and this is the controller

class HomePageController < ApplicationController

def login

#More than 2 parameters means an post (there is always a post couse

it’s ajax)

if params.length == 2

        @user = User.new


  if @user.username == "foo" && @user.password == "foo"

    logger.warn "loggin failed, refresh only InnerDiv and show the



    logger.warn "loggin failed, refresh MainDiv"



#Show the page

@headers["Content-Type"] = "text/html; charset=ISO8859-1"

render :layout => false



Rodrigo D.

Iplan Networks Datos Personales

[email protected] [email protected]

www.iplan.com.ar http://www.iplan.com.ar/
www.rorra.com.ar http://www.rorra.com.ar/

5031-6303 15-5695-6027

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs