How call alert method from controller (something like rende :ajax => 'some text')?

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!


Regards,

Luiz Vitor Martinez C.
cel.: (11) 8187-8662
blog: rubz.org
engineer student at maua.br

“Posso nunca chegar a ser o melhor engenheiro do mundo, mas tenha
certeza de
que eu vou lutar com todas as minhas forças para ser o melhor engenheiro
que
eu puder ser”

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

On Aug 15, 6:17 am, “Luiz Vitor Martinez C.” [email protected]

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.

On Thu, Aug 14, 2008 at 10:49 PM, Mukund [email protected] wrote:

wrote:

end

que

eu puder ser"


Regards,

Luiz Vitor Martinez C.
cel.: (11) 8187-8662
blog: rubz.org
engineer student at maua.br

“Posso nunca chegar a ser o melhor engenheiro do mundo, mas tenha
certeza de
que eu vou lutar com todas as minhas forças para ser o melhor engenheiro
que
eu puder ser”

On 15 Aug 2008, at 03:51, Luiz Vitor Martinez C. wrote:

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

Fred,

Why it don’t shows the pop-up containing “some text…” message?

Regards,
Luiz Vitor.

On Fri, Aug 15, 2008 at 6:38 AM, Frederick C. <
[email protected]> wrote:

} catch (e) { alert(‘RJS error:\n\n’ + e.toString());
On Thu, Aug 14, 2008 at 10:49 PM, Mukund [email protected] wrote:
wrote:

end

engenheiro que
blog: rubz.org


Regards,

Luiz Vitor Martinez C.
cel.: (11) 8187-8662
blog: rubz.org
engineer student at maua.br

“Posso nunca chegar a ser o melhor engenheiro do mundo, mas tenha
certeza de
que eu vou lutar com todas as minhas forças para ser o melhor engenheiro
que
eu puder ser”

On 16 Aug 2008, at 18:25, “Luiz Vitor Martinez C.”
<[email protected]

wrote:

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

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