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

foo

<%= 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

else

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

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

error"

  else

    logger.warn "loggin failed, refresh MainDiv"

  end

end

#Show the page

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

render :layout => false

end

end

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