I have a data structure contained in a local Json file. I want to load it using $.getJSON()
.
json file locations.json:
{locations:
[{value: "Port Kelang",label: "Port Kelang",category: "Malaysia"},
{value: "Pusan",label: "Pusan",category: "South Corea"},
{value: "Qingdao",label: "Qingdao",category: "China"}]}
javascript file :
$.getJSON("locations.json", function(data){
//do something
});
Using Chrome, I got an error :
XMLHttpRequest cannot load file:///E:/locations.json. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
While I got another error in Firefox :
XML Parsing Error: not well-formed Location: file:///E:/locations.json Line Number 1, Column 1:
Any help? Thanks in advance.