简体   繁体   中英

IE can't read JSON file

I'm trying to load a json file dynamically. It's 2MB zipped. When I look at it through most browsers (including IE) at radioladio.com/data/1.json , the json file is automatically unzipped and displayed as the expected text. However, when I try to load it and read it dynamically ( radioladio.com/radioplayer ) in IE, it says there is an invalid character. I have a feeling this may be something to do with encoding but I'm not too knowledgeable about this sort of thing. It seems IE may think that it is HTML not json?

Try using jQuery's $.get , specifying dataType: "json" or use shorthand: $.getJSON . I think that you're not specifically saying it's a json datatype so IE takes a default of html. I might be wrong, let me know if that works!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM