[jQuery] how can I treat a string as JSON?
I use $.getJSON for all my ajax stuff and it works beautifully but
there is one particular situation where I use an iframe hack to do an
ajax file upload and even though the returned value is a json object
(created with PHP), jQuery treats it like a string.
I'm using json2.js right now and it does the trick but I don't like
including that much extra code because of one rare situation.
So my question is, be it with $.getJSON or by specifying 'json' as the
expected return type of an ajax request, jQuery *seems* to be able to
convert into json.
The string returned is already a json object, I just need jQuery to be
able to treat it like one. I've tried wrapping it in a jQuery object
but no use. (and I really don't want to go down the eval() path)...
Any suggestions?
Thanks!!