How do you read a file in the current directory using JQuery.getJSON()?
I'm trying something simple (with my data.json file in the same directory as my html file):
$.getJSON("./data.json")
and I get the error:
XMLHttpRequest cannot load file:///C:/Projects/test/data.json. Origin null is not allowed by Access-Control-Allow-Origin.
I've tried all sorts of combinations of path, but it doesn't seem to work...
EDIT: I'm using Chrome, but I'd like to work in all browsers...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…