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

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Jim Ruther Nill at Dec 5, 2011 at 1:50 am

    On Mon, Dec 5, 2011 at 9:13 AM, Nike Mike wrote:

    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)
    try this

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

    Please help us

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.

    --
    -------------------------------------------------------------
    visit my blog at http://jimlabs.heroku.com

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Nike Mike at Dec 5, 2011 at 5:42 pm
    Thanks its working

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedDec 5, '11 at 1:14a
activeDec 5, '11 at 5:42p
posts3
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Nike Mike: 2 posts Jim Ruther Nill: 1 post

People

Translate

site design / logo © 2021 Grokbase