I have just upgraded to the latest scriptaculous (1.8.2) which
includes prototype 1.6.0.3 and the following code no longer works:-
Ajax.JSONResponse = function(xhr) {
var data=eval('('+xhr.responseText+')');
Object.extend(data,Enumerable);
Object.extend(data,Hash);
return data;
};
.......
var opts = Ajax.JSONResponse(xhr);
if (opts.size()>0) {
opts.each(function(opt) {
.....
There is no error, it just seems that execution stops when trying to
access any method of the opts object. I checked the response returned
by Ajax in the previous and the latest versions, by doing console.log
(data) after the eval, and they are identical. However, if I replace
the eval line in the above code with this line
var data=$H(eval('('+xhr.responseText+')'));
it now works.
I didn't write the original code and I am relatively new to prototype.
Can anyone tell me whether the $H() is the correct solution or is
there an alternative (better) solution.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---