I've been struggling for hours to get an array (aAssetToggled[LNum]
[T]) toJSON so I can save, by Ajax, it to a db in CakePHP - all I get
is '[]' - this is how Chrome shows it to me:

aAssetToggled: Array[0]
LNum0: Array[0]
T147: "true"
length: 0
__proto__: Array[0]
LNum1: Array[0]
LNum2: Array[0]
T147: "true"
length: 0
__proto__: Array[0]
LNum3: Array[0]
length: 0
__proto__: Array[0]

I'm sure I must be doing something wrong as all those 0's suggest that
Chrome, and presumably Prototype, think the array itself has no length
and contains zero-legth arrays. However, presumably because of the
lenience of the browsers, it still works exactly as it should in my js
code - I can ask aAssetToggled['LNum0']['T147'] for its value and I
get 'true'.

I define the array initially with

var aAssetToggled = new Array();

empty it occassionally with:

if (it needs to be emptied)
                aAssetToggled = [];

then repopulate it with:

                aAssetToggled['LNum0'] = new Array();


aAssetToggled['LNum0']['T'147'] = "true";

Note that it was initially indexed with integers aAssetToggled[0][147]
but I thought that might have been the problem (lots of empty space?)
so went with string keys.

Any idea what I'm doing wrong?

Thank you


You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to