When we open the webpage that contains the javascript code to load xml file locally in chrome , get the following error
"XMLHttpRequest cannot load file:///C:/Temp/category.xml. Cross origin requests are only supported for HTTP."
Local file access is disabled by default for security reasons. It would be more secure if you just start a local webserver and fetch your html and xml from localhost.If you're using Chrome, and you have a local HTML file that uses Javascript to load an XML file , it just won't work.
To get around this use a script tag ,not XMLHttpRequest. Here's an example with JSON.
First create json data equivalent to the xml file and write into a local file called say category.js
Then get the file from your local html page using:-
<script type="text/javascript" src="category.js"></script>
So you need not use a .json file and XMLHttpRequest,just a plain old script tag.