$.getJSON is not working in Chrome. But working if we use a web server.

$.getJSON is not working in Chrome. But working if we use a web server.

Hi Guys,

I have a simple HTML file which is actually making some bunch of ajax calls after it reads the URLs from a json file.

So to read the JSON file, i am using the method $.getJSON as below.  This working fine, if I run the HTML file as a application via Apache web server.

  1. $.getJSON("WebServices.json", function( response ) {

But if I run the HTML file as a simple html file directly on Chrome browser, I am getting the error below.  However the same code is working fine with IE and FF.  The json file is in the local machine only and on the same path where i have HTML file.

  1. OPTIONS file:///C:/opt/test/www/unsecure/TestWS/WebServices.json?callback=jQuery17106621109563857317_1387920168422&_=1387920168429 No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. jquery.js:8102
XMLHttpRequest cannot load file:///C:/opt/test/www/unsecure/TestWS/WebServices.json?callback=jQuery17106621109563857317_1387920168422&_=1387920168429. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.