On my web server I have a folder (say the link is: www.foo.com/json/).
Inside this link, I have a json file, like foo.json. I want to access this file from another website. I've tried to research CORS but it seems pretty complicated, and I don't use any backend in on my website foo.com. I've heard you can simply use php and put this in:
<?php
header(Access-Control-Allow-Origin: *);
How do I add this to that folder that has the .json so that when I do:
$.getJSON(http://foo.com/json/foo.json, function(json) {
console.log(json
)});
It won't throw the error. I want this to be simple to let any website do it, I just don't know how to connect it all.