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 :-)
on 2008-07-02 15:26
on 2008-07-02 15:31
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.