How to render a partial from javascript?

You can't render a partial inside of JavaScript to detect change events. Ruby is server side, and JavaScript is client side. By the time your JavaScript runs, your Ruby has already been parsed into regular ol' HTML Your best bet is to do the following: Use an AJAX control (there are Prototype/scriptaculous ones) to hit your server in the onchange event.

Your server can send back RJS to update the other dropdowns or it can return back standard JSON and you can populate the other dropdowns manually in the onSuccess method of the AJAX call.

You can't render a partial inside of JavaScript to detect change events. Ruby is server side, and JavaScript is client side. By the time your JavaScript runs, your Ruby has already been parsed into regular ol' HTML.

Your best bet is to do the following: Use an AJAX control (there are Prototype/scriptaculous ones) to hit your server in the onchange event. Your server can send back RJS to update the other dropdowns, or it can return back standard JSON and you can populate the other dropdowns manually in the onSuccess method of the AJAX call.

Oh, wow, I didn't even get that this was a static file; I thought they were hitting it multiple times. – Matchu Feb 25 '10 at 2:35 I believe it's a static file. The question is a little bit vague on that aspect.

– Mike Trpcic Feb 25 '10 at 2:42 Ah yes, in a static file. – 99miles Feb 25 '10 at 15:37.

I think this is what you are looking for. I am rendering the partial within a DIV with "colors" ID, the partial is rendered only if the selected radio button's value is red.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions