0

I can't access my JSON file using jQuery.

$.getJSON( "test.js", function( json ) {
    console.log( "opened" );
});

It is valid in jsonlint, but when I open the JSON using XAMPP it fully loads but in chrome console it shows:

Error in event handler for (unknown): IndexSizeError:
Failed to execute 'setStart' on 'Range':
The offset 2028210 is larger than or equal to the node's length (32768).
    at displayError (chrome-extension://chklaanhfefbnpoihckbnefhakgolnmc/content.js:18:8)
    at chrome-extension://chklaanhfefbnpoihckbnefhakgolnmc/content.js:269:40"

Can anyone explain what could be causing this error? It is a fairly large file. When I open it in Safari it doesn't show the error but it also won't load the data

trincot
  • 317,000
  • 35
  • 244
  • 286
Ali_bean
  • 341
  • 3
  • 14
  • 1
    Are you sure that error is relevant to your code? That error was generated by a browser extension. – elixenide Jun 07 '15 at 22:49
  • @EdCottrell - Good spot. The error appears to come from an extension called [JSONView](https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc?hl=en) Related question: [JSON is invalid (JSONview), but I don't see how](http://stackoverflow.com/questions/12628683/json-is-invalid-jsonview-but-i-dont-see-how) – Yogi Jun 07 '15 at 23:00
  • i'm trying to figure out why it won't read the JSON file, and thats the only error i could find, there aren't any errors when running the page, but it doesn't print opened, do you have any idea? its a valid JSON file – Ali_bean Jun 07 '15 at 23:01
  • @Ali_bean It's not clear what's going on. Is the URL "test.js" correct for your JSON file? Also, it might be an issue with the content-type header. – elixenide Jun 07 '15 at 23:05
  • $.getJSON( "business_and_reviews_json.json", function( json ) { console.log("loaded"); }); so when i run the page, it just doesn't load the json, when i open the json file in chrome, i get that error, so i'm thinking that must be why it won't load. but I don't get that error in safari – Ali_bean Jun 07 '15 at 23:09
  • Could you open the Developer Tools of your Browser (press F12), navigate to the "Network" tab and reload the page. Please copy the response headers (as text or screenshot) and edit your question to include it. I assume that either it's a path issue or incorrect content type problem. Could you also try `$.ajax( "business_and_reviews_json.json", { success: function(data) { console.log(data);});` and see if that shows the file's content in the browser console? – SaschaM78 Apr 27 '19 at 14:47

0 Answers0