Hi All,
I have a problem with the AJAX requests in rails. Consider a
controller class C with some methods M1, M2, M3. For this controller
class I have a view V.rhtml.
Within V.rhtml I have a periodically_call_remote AJAX request script
to call the method M1 after every 5 seconds say.
However, when I do this , I observe that for every new AJAX request a
new instance of my controller class C gets created with default values
of the instance variables, whereas I need the values of variables from
my current instance of the Class C .
Any clues as to how can I maintain a single class instance for all of
my AJAX requests from a particular client.
TIA
~Shishir
Shishir Srivastava wrote:
Hi All,
I have a problem with the AJAX requests in rails. Consider a
controller class C with some methods M1, M2, M3. For this controller
class I have a view V.rhtml.
Within V.rhtml I have a periodically_call_remote AJAX request script
to call the method M1 after every 5 seconds say.
However, when I do this , I observe that for every new AJAX request a
new instance of my controller class C gets created with default values
of the instance variables, whereas I need the values of variables from
my current instance of the Class C .
Any clues as to how can I maintain a single class instance for all of
my AJAX requests from a particular client.
TIA
~Shishir
Save whatever you need to persist between AJAX calls to the session object.