2009/10/2 Dave <[email protected]>:
>
> On Oct 2, 10:46 am, Richard Quadling <[email protected]> wrote:
>>
>> What headers are you supplying with the JSON'd data from the server?
>>
>> For JSONP, I use Content-type: application/javascript
>> For JSON, I use Content-type: X-JSON
>>
>> These work great for me.
>
> Thanks for the reply.
>
> The server code wasn't setting headers explicitly so I've now added
> this, setting it to application/json, and I get a return value in the
> second parameter. This now saves me needing to do the eval on the
> responseText, but my original problem still exists in that having
> upgraded to prototype 1.6.0, the original code no longer works unless
> I convert the reply to hash using $H(). I don't know if this is now
> the correct way of handling this, or whether I should be doing
> something else, or whether it is a bug. As far as I can tell, the
> purpose of the code was to extend the evaluated response text to add
> iterator methods. When I compare the old and new version responses I
> can see no difference, but something has changed between the prototype
> versions as the object.extend now causes the code to fail when I try
> to iterate using object.each.
> >
>

I have a JSON object ...

{"Result":"1","UniqueID":"5","Username":"Chrome","Email":"************","LastLogin":"Monday,
14<sup>th<\/sup> September 2009 at 10:28
AM","ContractID":"0","Password":"************","Rights":{"Disabled":false,"UserAdmin":false,"ReportAdmin":false,"RunReports":true}

To iterate the Rights, I use ...

        $H(o_JSONUser.Rights).each
                (
                function(h_Right)
                        {
                        $('tabUA_Rights' + h_Right.key).checked = (1 == 
h_Right.value);
                        }
                );

So, I would say you have to turn the "object" to a "Hash" for each()
to work on it.

-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to