It seems that Chrome's JSON. Parse barfs on escaped apostrophe.
Up vote 2 down vote favorite share g+ share fb share tw.
This one's perhaps a little long-winded, but it's really baffling me and a couple of other people. We've got a progress bar that's updated during file uploads. The JS is here (too much to paste into this body).
Basically, the form submit event starts a timer loop which, every 2 secs, fires a $.getJSON() call to the server to retrieve a pair of values about the status of the upload. These values are then passed to a function that updates the progress bar. The JSON values returned are def valid JSON.
Now, this code works fine on Firefox and all IEs (even 6), so I'm pretty confident that the server-side code is robust, but... in Safari and Chrome, the progress bar just doesn't update at all. The upload is processed by Apache fine, and console.log() debugging shows that the timer loop is definitely running -- it's just that getJSON seems not to be firing (the web inspectors don't show the call, and neither does the Apache log. As said, it's a bit baffling.
Anyone come across this before with Chrome/Safari/Webkit? Jquery safari webkit google-chrome getjson link|improve this question asked Jul 15 '10 at 11:13stevejalim4,658918 80% accept rate.
It seems that Chrome's JSON. Parse barfs on escaped apostrophe: "barf\'" while unescaped apostrophe works fine: "accept'" I have been able to circumvent similar problem by leaving the apostrophe unquoted for Webkit based browsers. It might be something similar in your case.
Perhaps this question can provide a few ideas about debugging. I have found both Safari and Chrome to be somewhat buggy with the way they handle JS as well, so, you're definitely not alone.
Thanks for the support. I've tried lots of debugging methods, but not yet jQuery.ajaxSetup. Will give it a go – stevejalim Jul 19 '10 at 6:23.