I may be showing my ignorance here, but why (or maybe more appropriately "how") would invalid json code get returned by your ajax call? Shouldn't you just make sure that the data coming back is valid json? Maybe I've not run into this because I'm using Jehiah Czebotar's CFJson (obviously, my back end is ColdFusion), and it's because his code is good at converting my data structures into json. I dunno. What do you think?

Chris

Dave Methvin wrote:
If you specify json output in the $.ajax call and the resulting output isn't
well-formed json for any reason, it causes a javascript error on the eval in
$.ajaxData. Has anyone else encountered this? My quick fix was to wrap the
eval in a try/catch and return null if there was an error, does that sound
like the right course? I think it's desirable for the ajax code to be able
to handle bad json, especially when I'm the one writing the server-side
code. :) The script case in ajaxData probably needs similar treatment.


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to