![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I need some help here. When I try to eval() my AJAX returned JSON string, I continually get a javascript error "Expected )". Here's my JSON string: {"recs": [{"RepKey": "RepKey", "RepID": "RepID", "Type": "Type"}, {"RepKey": "1", "RepID": "000", "Type": "RTRR"}, {"RepKey": "2", "RepID": "0M2", "Type": "RTRR"}, {"RepKey": "3", "RepID": "1DV", "Type": "RTRR"} ]}; My js function simply tries to eval() it: var jsonStr = eval('(' + str + ')'); When I write str to a div, I get the above JSON string without js errors. This is driving me crazy. Any help would be hugely appreciated. Thanks, asleep |
is wrong.
#3
| |||
| |||
|
|
On Feb 5, 5:23 pm, "asleepatdesk" <s... (AT) scoleman (DOT) net> wrote: Hi, I need some help here. When I try to eval() my AJAX returned JSON string, I continually get a javascript error "Expected )". Here's my JSON string: {"recs": [{"RepKey": "RepKey", "RepID": "RepID", "Type": "Type"}, {"RepKey": "1", "RepID": "000", "Type": "RTRR"}, {"RepKey": "2", "RepID": "0M2", "Type": "RTRR"}, {"RepKey": "3", "RepID": "1DV", "Type": "RTRR"} ]}; My js function simply tries to eval() it: var jsonStr = eval('(' + str + ')'); When I write str to a div, I get the above JSON string without js errors. This is driving me crazy. Any help would be hugely appreciated. Thanks, asleep Get rid of the ; at the end. ({asdf:'foo'} is wrong.({asdf:'foo'}) is ok. -- Isaac Z. Schlueterhttp://isaacschlueter.com- Hide quoted text - - Show quoted text - |
#4
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |