var jsonvar;
eval('jsonvar = '+msg.d+');
for(var i = 0;i<jsonvar.length;i++)
{
dochicken(jsonvar[i].Chicken);
}
as
for(d = 0;d < (void 0).length;d++) {
dochicken((void 0)[d].Chicken);
}
So don't declare your json ajax receptor before usage.
Revised according to comment:
Closure can start to do weird things if you include variable names in eval text.
This is a better solution from John:
var jsonvar = eval("(" + msg.d+ ")");
for(var i = 0;i {
dochicken(jsonvar[i].Chicken);
}
CHIKEN();CHIKEN();
This is a better solution:
ReplyDeletevar jsonvar = eval("(" + msg.d+ ")");
for(var i = 0;i<jsonvar.length;i++)
{
dochicken(jsonvar[i].Chicken);
}