title: Fix CORS error without disabling security in chrome
body: <p>I have a javascript code which loads json data from some json_url using ajax requests I am getting folloowing error when running the html in chrome</p>
  
  <pre><code> Access to XMLHttpRequest at json_url from origin 'http://localhost:8000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
  </code></pre>
  
  <p>To fix this error I am opening chrome by disabling web security through the following command
  <code>google-chrome --disable-web-security --user-data-dir="/tmp/chrome_dev_test"</code></p>
  
  <p>Is there anyway to fix this error so that I can run html on chrome without disabling web security every time?</p>
  
  <p>front-end code used:</p>
  
  <pre><code>function getJSON(url){
      $.ajax({
          type:'GET',
          url:url,
          dataType:'json',
          contentType:'application/json', 
          timeout: 3000,
          success:function(data){
              //do something with data
          }
     });
  }
  </code></pre>