Grabber
(Grabber)
August 15, 2008, 1:17am
1
Yeah,
I’m needing to show a popup window after the execution of method. I’m trying something like:
def bla
respond_to do |format|
format.html { redirect_to … }
format.js
end
end
bla.rjs
page.alert(‘some text’)
How can i do it?
Thanks for your attention!
Mukund
(Mukund)
August 15, 2008, 1:49am
2
Use the render command in your controller. Remember that you can
render or redirect only once per action. Look at api.rubyonrails.org
for more options.
render :update do |page|
page.alert "hi"
end
Grabber
(Grabber)
August 15, 2008, 2:51am
3
mukund,
That’s ok. I tried it after, and get:
try {
alert("some text...");
} catch (e) { alert('RJS error:\n\n' + e.toString()); alert('alert(\"some text...\");'); throw e }
Regards,
Luiz Vitor.
mukund,
That's ok. I tried it after, and get:
try {
alert("some text...");
} catch (e) { alert('RJS error:\n\n' + e.toString());
alert('alert(\"some text...\");'); throw e }
That's looks like the right javascript. What's wrong?
Fred
Grabber
(Grabber)
August 16, 2008, 5:25pm
5
Fred,
Why it don’t shows the pop-up containing “some text…” message?
Regards,
Luiz Vitor.
Fred,
Why it don’t shows the pop-up containing “some text…” message?
What does your link_to_remote ( or whatever it is you are using to invoke the action) look like? If you’re passing an :update option, don’t.
Fred