I\'m trying to load a local JSON file but it won\'t work. Here is my JavaScript code (using jQuery):
var json = $.getJSON("test.json");
var data = e
If you are using a local array for JSON - as you showed in your example in the question (test.json) then you can is the parseJSON()
method of JQuery ->
var obj = jQuery.parseJSON('{"name":"John"}');
alert( obj.name === "John" );
getJSON()
is used for getting JSON from a remote site - it will not work locally (unless you are using a local HTTP Server)