Ajax dialogs with jquery

Hi,

In my application, we are calling a dialog box to submit a value through
ajax.After submit how to show the welcome message in the same dialog.

In my views file at the first the dialog block is in hidden mode.On
clicking an anchor we are displaying the dialog block form.Through Ajax
we are submitting the values. In my .js.erb alert messages are working
fine.

But how to place the entire layout with the dialog welcome message ?

Controller :

def send_message
    @message = current_user.messages.build(params[:message])
    @message.receiver_id = @user.id
    respond_to do |format|
      if @message.save
        format.html {redirect_to user_url(current_user)}
        format.js
      end
    end
  end

send_message.js

alert(@message.description)

Please help us

Hi,

In my application, we are calling a dialog box to submit a value through

ajax.After submit how to show the welcome message in the same dialog.

In my views file at the first the dialog block is in hidden mode.On

clicking an anchor we are displaying the dialog block form.Through Ajax

we are submitting the values. In my .js.erb alert messages are working

fine.

But how to place the entire layout with the dialog welcome message ?

Controller :

def send_message

@message = current_user.messages.build(params[:message])

@message.receiver_id = @[user.id](http://user.id)

respond_to do |format|

  if @message.save

    format.html {redirect_to user_url(current_user)}

    format.js

  end

end

end

send_message.js

alert(@message.description)

try this

$(’#dialog_box_id’).html(’<%= escape_javascript @message.description%>’)

Thanks its working