Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
45
rated 0 times [  47] [ 2]  / answers: 1 / hits: 26448  / 13 Years ago, fri, december 16, 2011, 12:00:00

I am desperately trying to get a local build of a site to get a JSON file (also local) with no luck. The exact code worked perfect on my server, but once local, breaks.



I get the JSON with jQuery like so:



$.getJSON(
lib/js/app.json,
function(data){
$.each(data, function(i,user){
+'<img src='+user.thumbnail+'/>
});
}
);


And receive this console error:



XMLHttpRequest cannot load file://localhost/Users/blakestruhs/new/lib/js/app.json. Origin null is not allowed by Access-Control-Allow-Origin.


I'm dying for an answer here. Please help me.


More From » jquery

 Answers
7

I think you use a Webkit browser like chrome, right? Chome does'n see a relation between two local files. Use Firefox or run it on a webserver ;)



"Origin null is not allowed by Access-Control-Allow-Origin" in Chrome. Why?


[#88527] Wednesday, December 14, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tristab

Total Points: 735
Total Questions: 106
Total Answers: 96

Location: Grenada
Member since Sun, Dec 20, 2020
3 Years ago
tristab questions
Sat, Sep 25, 21, 00:00, 3 Years ago
Sun, Jan 31, 21, 00:00, 3 Years ago
Wed, Dec 2, 20, 00:00, 4 Years ago
Fri, Oct 23, 20, 00:00, 4 Years ago
;