Reputation: 31
$.getJSON('test1.json', function(data)
{
for (i in data.conferences) {
var item = data.conferences[i];
array1.push({
cid:item.id,
confName: item.cname,
confStart:item.start
}); }
});
I use the function for getting values from java to jquery. In chrome and opera shows same error, but it works on IE and mozilla.
Give me a solution for that please.
XMLHttpRequest cannot load file:///C:/Users/winnova1/Desktop/tree/conferences/test1.json. Origin null is not allowed by Access-Control-Allow-Origin.
Uncaught TypeError: Cannot read property 'conferences' of null
Upvotes: 1
Views: 5140
Reputation: 129011
For security reasons, on Chrome and Opera you cannot use XMLHttpRequest
to load local files.
You must run it on a web server, even if that web server is running on localhost
.
Upvotes: 1