I am trying to load json into a javascript file like so:
$().ready(function () {
      var url = 'url/fname.json';
      $.get(url, function (data) {
        // can use 'data' in here...
        console.log(data)
      });
    });
However, I get the errors "Origin null is not allowed by Access-Control-Allow-Origin" and "[Error] XMLHttpRequest cannot load due to access control checks".
Others have suggested adding Access-Control-Allow-Origin: <origin> | * (Safari 10.1: XMLHttpRequest with query parameters cannot load due to access control checks) or header('Access-Control-Allow-Origin: null'); (XmlHttpRequest error: Origin null is not allowed by Access-Control-Allow-Origin), but it's unanswered in those posts where that header goes in an html file. 
Is adding this line the solution to my problem? If so, where should I put it?