Hello!
I have an ajax call generated by cakephp that should update multiple
divs like so:
new Ajax.Updater(
document.createElement(''div''),
url_to_ajax_call,
{asynchronous:true, evalScripts:true,
requestHeaders:[''X-Update'',
''div1 div2'']});
Now this works fine but problems occure when I add some javascript in
the response. A simple thing like this next line of code has some
unexpected behaviors:
window.myObjectDeclared.anArrayMember[3255] = someData;
alert(window.myObjectDeclared.anArrayMember.length); //returns 3255
While there really is just one element in this array. The exact same
code does work before the ajax (length is 1). Does somebody know what
the problem could be? I hope I made myself clear, it''s a bit
complex :-)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
If you assign something to the 3255th element of an array, your array now has 3255 elements. That''s how arrays work. :-) -Fred On Jul 2, 2008, at 8:26 AM, Marcelius wrote:> window.myObjectDeclared.anArrayMember[3255] = someData; > alert(window.myObjectDeclared.anArrayMember.length); //returns 3255-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
lol, I''ve never noticed that before... I had performance issues when assigning 2 elements in an array, but that makes sense now with the high numbers... I solved this using a Hash instead of an Array and now works great! Thanks for the response! On 2 jul, 15:30, Frederick Polgardy <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote:> If you assign something to the 3255th element of an array, your array > now has 3255 elements. That''s how arrays work. :-) > > -Fred > > On Jul 2, 2008, at 8:26 AM, Marcelius wrote: > > > window.myObjectDeclared.anArrayMember[3255] = someData; > > alert(window.myObjectDeclared.anArrayMember.length); //returns 3255 > > -- > Science answers questions; philosophy questions answers.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---