Friday, 15 August 2014

how to turn json file into Javascript string var -



how to turn json file into Javascript string var -

i want load json local (i mean it's in same folder index.htm) string var in javascript.

i tried that:

var json = require('state.json');

but doesn't work. tried other version this:

var json = require(['state.json']);

and failed again.

if can avoid using xmlhttprequest fine.

security settings in browsers not allow interact file scheme through javascript. have serve web server.

javascript json requirejs

No comments:

Post a Comment