I am new to this, it may be an easy question. I have explored enough about this on internet. I just need some more insight in this issue :
I am using this to get a json file which is one hierarchy down from where index.html
is present in my directory structure. I am using jquery.ajax as below:
$.ajax({
url: "../myFile.json",
dataType: 'json',
success: function(result, Status, jqXHR) {
MyFunction(result);
},
error: function(Status) {
alert(Status.statusText + ": Wrong input. Please check the file.");
}
});
Here, I am trying to access myFile.json
as shown below. This doesn't work and I get error in firefox something like this
(Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource....)
When I keep myFIle.json in the same directory(or above the hierarchy of directory) where index.html is, it works absolutely fine.
NOTE: I am not hosting it anywhere. I have just made a simple index.html and running it in my machine in firefox.
Please throw some light on this issue. I want clear concept behind what is happening here.