But a
better way to do it is probably to do: Eval is
likely slower than a string split(), but that code would only work in the case
that the values never contained a comma. Anyhoo, just food for thought, but it
may require some tweaking of your server-side code to make sure no commas end
up in the values. The call to replace() would not be necessary if the server
side simply returned: value 1, value 2, value 3 instead of [‘value 1’,
‘value 2’, ‘value 3’]. Greg From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Joe Hudson 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