Read Json file data using javascript? -
function uploadjsonfunction(){ var jsonurl = "c:\users\my documents\new\webcontent\jsonfiles\treejson\countries.json"; } - countries.json valid json , above path has countries.json file.
- i want read countries.json file whole data/contents using javascript.
here json:
{ identifier: 'id', label: 'name', items: [ { id: 'af', name: 'africa', type:'continent' } ] }
$.ajax({ url: "\countries.json", success: function (data) { var obj = json.parse(data); } }); for safety reasons, c:\users\my documents\new\webcontent\jsonfiles\treejson\countries.json url won't work in browser.
Comments
Post a Comment