jquery - Parse JSON File in Javascript -


i have json file stored in same folder html file webpage i'm working on. html file has script function takes data in variable in json form. i'm having trouble getting contents of json file variable in html file used function. running html file locally.

i've tried following:

$(function(){     $.getjson("./data.json", function(jsdata) {         json = jsdata;         console.log(json);     }); }); 

however, results in: xmlhttprequest cannot load file. there way parse local json file in javascript?

the json validated using http://jsonlint.com/

using "data.json" gives same error before.

do not use .. if json file in same folder location js running (i.e. html file), should this:

$(function(){     $.getjson("data.json", function(jsdata) {         json = jsdata;         console.log(json);     }); }); 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -