passing an array to AJAX event not working

Hello
i define an array in OnApplicationInit
$ar= array();
sc_set_global($ar);

and if i try to print the array i see this : array() a string not an array.
how can i use an array in AJAX event ? i must declare it outside of the event it self so that it will not get recreated every time the event fire.
Thanks

after doing a foreach loop and assigning the array to a global variable i only see the first item in the array.

If it doesn’t work it might be a bug. Perhaps you can use a workaround using (un)serialize?

storing the array in a session solved it
Thanks