11175
(-- --)
March 23, 2008, 6:41pm
1
Hello, is there something like a "call_remote" ?
I would like to execute an RJS template after a page is loaded so that
it sets up the screen's hidden fields as required when Ajax is in play.
(I don't want to make certain things hidden by default as I want them to
show if Javascript is disabled, and I'd prefer not to duplicate code
client-side that I already have in my rjs files).
Thanks.
11175
(-- --)
March 23, 2008, 6:50pm
2
John Lane wrote:
Hello, is there something like a "call_remote" ?
I would like to execute an RJS template after a page is loaded so that
it sets up the screen's hidden fields as required when Ajax is in play.
You can add:
<%= javascript_tag(remote_function :url => ... ) %>
to the page which will cause it to call the specified action which can
send back the updates. Is this what you mean?
11175
(-- --)
March 23, 2008, 7:29pm
3
Sorted it like this with Javascript:
Event.observe( window, 'load', function() {
<%= remote_function :url => {:action => :display_fields, :only_path =>
:false}%>
} );
Not sure if this is the best way, but it does what I need.
11175
(-- --)
March 24, 2008, 12:52pm
4
Mark Bush wrote:
You can add:
<%= javascript_tag(remote_function :url => ... ) %>
Thanks Mark. My solution worked but this is what I actually wanted - I
just hadn't thought of it that way. Much more elegant. Thanks!