On Feb 24, 8:43 am, Richard Quadling <[email protected]> wrote: > Hi. > > I'm using JSONP to pass data from the server to the client. > > Normally the call is like ... > > tabRA_UpdateReportIDs({"13":"Richard Quadling's demo report (Richard's > complicated report)"}); > > A hash. > > In some instances, there is no data and the call looks like this ... > > tabRA_UpdateReportIDs([]); > > An array. > > As I understand things, this is not incorrect. I'm using PHP and I've > placed a request to allow for an option to force empty arrays to be an > empty hash for the json_encode() function. On the json_decode() > function, there is an option allowing the user to decide between an > object or an associative array (object or hash), so having a similar > option on the json_encode() side would, on the surface, seem useful. > (http://bugs.php.net/bug.php?id=47493) > > My point in contacting this group is to see if ... > > $H([]) > > should work like ... > > $H({}) > > If you run these commands in console you get quite different output ... > > $H({}).each(function(h){console.debug(h);}); > > vs .. > > $H([]).each(function(h){console.debug(h);});
`$H([])` produces something that it was never intended to produce - an object extended with Array.prototype.* methods. You probably don't ever want to use it. -- kangax --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
