Hi list,
I''m trying to get a local javascript variable submitted with
remote_function:
<script language="javascript">
var local_variable = "I do really important stuff";
<%= remote_function :url => {:action => "boo", :id=> 1},
:submit =>
''local_variable'' %>
</script>
The above snippet seems to be close but generates
new Ajax.Updater(''foo'', ''/temp/boo/1'',
{asynchronous:true,
evalScripts:true,
parameters:Form.serialize(''local_variable'')})
but I don''t want the form to be serialized (there is no form!) I want
the value of ''local_variable'' to be serialized and submitted.
Any ideas?
Thanks,
Dan
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
Maybe remote_function http://rubyonrails.org/api/classes/ActionView/Helpers/PrototypeHelper.html#M000420 with a :with parameter will help? Vish On 9/29/06, dang <dgreig-vQs5aMGR+7nQT0dZR+AlfA@public.gmane.org> wrote:> > > Hi list, > > I''m trying to get a local javascript variable submitted with > remote_function: > > <script language="javascript"> > > var local_variable = "I do really important stuff"; > <%= remote_function :url => {:action => "boo", :id=> 1}, :submit => > ''local_variable'' %> > > </script> > > The above snippet seems to be close but generates > new Ajax.Updater(''foo'', ''/temp/boo/1'', {asynchronous:true, > evalScripts:true, parameters:Form.serialize(''local_variable'')}) > > but I don''t want the form to be serialized (there is no form!) I want > the value of ''local_variable'' to be serialized and submitted. > Any ideas? > > Thanks, > Dan > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
thanks - looks like this might do the trick:
remote_function :url => {:action => "boo", :id=> 1},
:with =>
"''variable=''+local_variable"
It looks like this appends &variable=blah to the URL which is enough
for me, but it would be interesting to see if it could serialise and
post variable values as well - maybe some other time!
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---