[jQuery] Re: Error while printing the JSON content after evaluating!!!!

2008-11-29 Thread ricardobeat

you're evaluating this string (req.responseText). If I'm not
mistaken eval happens on the global scope, so I assume the 'req'
variable is not available globally.

Anyway, why are you using eval? jQuery handles JSON responses by
itself.

- ricardo

On Nov 28, 11:31 pm, aarti [EMAIL PROTECTED] wrote:
 Hi,

 I am getting error while trying to print the content of json string.
 My servlet is getting evaluated as it is alerting the next statement
 immediately after eval line in the code.

 0] alert(req.responseText);
 1] doc_json = eval('('+ req.responseText+')');
 2] alert(eval successful);
 3] alert(doc_json.feed.channels[0].name);

 It gives me alert upto 2] line as eval successful. Immediately after
 that I am getting error as doc_json undefined.
 I tested my json string, it is fine too.
 Can anybody please tell me what could be the problem?

 Thanks.


[jQuery] Re: Error while printing the JSON content after evaluating!!!!

2008-11-28 Thread seasoup

Heya, happy to help.  I have a few questions though.

1) Can/do you use firebug and console.log, it provides more
information.

2) How come you are putting parenthesis around req.responseText?

3) Can you show us the req.responseText?

Thanks,
Josh Powell

On Nov 28, 5:31 pm, aarti [EMAIL PROTECTED] wrote:
 Hi,

 I am getting error while trying to print the content of json string.
 My servlet is getting evaluated as it is alerting the next statement
 immediately after eval line in the code.

 0] alert(req.responseText);
 1] doc_json = eval('('+ req.responseText+')');
 2] alert(eval successful);
 3] alert(doc_json.feed.channels[0].name);

 It gives me alert upto 2] line as eval successful. Immediately after
 that I am getting error as doc_json undefined.
 I tested my json string, it is fine too.
 Can anybody please tell me what could be the problem?

 Thanks.