Okay - well here's what I'm really doing. I'm using an ajax upload plugin and
in the callback function, which returns a variable "data", I need to parse
it into a JSO so I can use it. Right now it's just a string.

                    onComplete: function(file, data) {
                        $('#uploadPics').show();
                        $('#loader').hide();

                        // evaluate response
                        var JSON = eval("("+data+")");
 

                        if (JSON.messages) {
                            // display messags
                            displayAlert(JSON.messages[0], "message");
                        } else {
                            displayAlert(JSON.errors[0], "error");
                        }

                    }

NONE of the code gets run after the eval line. I try putting in alerts
before it and after it and only the ones before it show up. I looked at the
javascript console in chrome and there are no errors. The "data" that gets
returned looks like this: 

uploadPicture{"errors":["This file was already uploaded"]}

so when I eval it, it should give me an object and I can refer to
JSON.messages[0] and whatnot
-- 
View this message in context: 
http://www.nabble.com/simple-JSON-parse-problem%21%21%21-tp24283450s27240p24289302.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to