0

Trying to fetch this 2.5mb file with $.getJSON() is giving me this error in Chrome Devtools. I'm led to believe that it might be a browser timeout causing the problem as the same method is working fine with smaller JSON files. The JSON syntax in the file is valid (JSONLint).

I'm relatively new to doing this so is there a way to fetch less data from that file or am I always going to run into the same issue no matter what? (unless I download server side first with, for example, PHP and compress - trying to avoid doing this as I wanted to do the project in only jQuery)

Adrian Payne
  • 165
  • 2
  • 12
  • Is that file on your domain? Otherwise you're probably running into a problem due to the [same origin policy](http://en.wikipedia.org/wiki/Same-origin_policy). – cfs Oct 16 '13 at 11:59
  • This is valid JSON, and there should absolutely not be any problem by a small 2.5 mb JSON - personally dealing with 10 or 20 times that, on pages rendered runtime. I **think** (very much) that it is your server settings for max file upload / download size that cuts the JSON off, probably by 2mb - hence the "Unexpected token :". – davidkonrad Oct 16 '13 at 12:03
  • Thanks for the replies. **cfs** - good spot but got around that with jsonp. **davidkonrad** - I'll check that out, thanks. – Adrian Payne Oct 16 '13 at 12:09

0 Answers0