getSelectedGridData()[getSelectedRow()] = eval(response.responseText);

 

I believe that will work.

 

Greg

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joe Hudson
Sent: Tuesday, April 18, 2006 12:56 PM
To: rails-spinoffs@lists.rubyonrails.org
Subject: [Rails-spinoffs] how to evaluate responseText as an array?

 

Hello,

I have an array of arrays (used for the seed of a grid component).  I am trying to update the grid at runtime so I have to update the underlying array.

 

Using the following code, I get the appropriate response but it is just a string… how can I convert it to an array?  Please see the example below:

 

            foo = new Ajax.Request(

                  url,

                  {

                        method: 'get',

                        parameters: params,

                        onComplete: function (response) {

                              alert(response.responseText);

                              getSelectedGridData()[getSelectedRow()] = response.responseText;

                        }

                  });

 

The response.responseText is “[‘value 1’, ‘value 2’, ‘value 3’]” but the code I have doesn’t work because it isn’t actually the array… it is the string representation of the array.  Could anybody help me please?  Thanks.

 

Joe

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to