I was trying to read an info.json
file, using the jQuery API. Please find the code below, which is part of test.html
.
$.getJSON('info.json', function(data) {
var items = [];
$.each(data, function(key, val) {
items.push('<li id="' + key + '">' + val + '</li>');
});
The test.html
file resides on my local machine and when I try to open it in the browser, the Ajax call is not getting triggered and the info.json
file is not read.
Is it not working because I don't have a web server? Or am I doing anything wrong in the code? (I don't see any errors in the Firebug console though).
Thanks in advance.