How to get a json file into a text variable in javascript -


i new using json file , wanna put file text variable in javascript run function not in object....
have been trying this.. nothing...

var jqxhr = $.getjson( "json/test.json", function() {                   console.log( "success" );                 })  alert (getdepth(jqxhr)); 

what going want retrieve contents of json file within success callback -

var jqxhr = $.getjson( "json/test.json", function(jsondata) {    console.log( jsondata ); }) 

note resulting variable (jsondata) not in fact contain text - contains javascript object.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -