$ .getJSON for the progress bar does NOT work in Safari and Chrome (but OK in IE6 + and FF)

This one may be a little long, but it really puzzles me and a couple of other people.

We have a progress bar that is updated during file downloads. JS is here (too much to insert into this body).

Basically, a form submission event starts a timer cycle, which every 2 seconds calls $ .getJSON () for the server to get a couple of values ​​about the load status. These values ​​are then passed to a function that updates the progress bar. The returned JSON values ​​are def valid JSON.

Now this code works fine in Firefox and all IE (even 6), so I'm sure the server-side code is reliable, but ... in Safari and Chrome, the progress indicator simply does not work updating at all.

The download is done using Apache fine, and debugging console.log () shows that the timer loop is definitely working - it's just that getJSON doesn't seem to work (web inspectors don't show the call, and none of them do the Apache log.

As said, this is a little puzzling. Has anyone come across this before using Chrome / Safari / Webkit?

+3
source share
2 answers

It seems that Chrome JSON.parse barfs on a shielded apostrophe:

[ "barf\'" ]

:

[ "accept'" ]

, Webkit. - .

+1

, . , Safari, Chrome , JS, .

0

Source: https://habr.com/ru/post/1754792/


All Articles