Topic: "Global Variable" Symbol for AJAX

I wrote a view that calls multiple methods with AJAX, but I'm having difficulty keeping params or symbols across methods. For example:


Some code here....
<%= remote_function(:url => {:action => "test1"}, :with => thisvariable) %>
<div id="me"></div>


def test1
  @t = thisvariable
  render :partial => thatOneOtherPartial


  <%= @t %> 
  <%= remote_function(:url => {:action => "test2"}, :with => @t) %>


def test2
  replace_html 'me', @t ######<<This is where Rails says "WTF is that?"####

I know the syntax isn't right, but the idea here is to have a symbol that I can assign a value to and have it remain throughout the session. Or even keep params alive, that would be easiest.

Re: "Global Variable" Symbol for AJAX

<%= remote_function(:url => {:action => "test1"}, :with =>"'avariable=HiThere;'" %>

def test1
  replace_html 'me', params[:avariable]


:with has gone away in 3.0,  alas it was obtrusive :<

Last edited by BradHodges (2010-12-28 12:06:36)

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.