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

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -