javascript - How can I access elements in an array? -
i have problem getting data json array.
here json code:
[ [ 4.440216064453125, [1,0,0,0,1,1,1,0,0,1,1], 0, "test0", "test0", [129] ], [ 4.452216148376465, [1,0,0,0,1,1,1,1,1,0,0], 1, "test1", "test1", [1,0,0] ] ]
and want alert "1" value. "test1".
here js code:
function inspect(){ $.ajax({ type: "get", url: 'addtest.json', datatype: "json", async : false, success: function(json) { alert(json.array[1]) }, error: function(json) { alert("error") } }); }
it's not working properly.
could please ?
json
defined object in javascript, use variable
function inspect(){ $.ajax({ type: "get", url: 'addtest.json', datatype: "json", async : false, success: function(response) { alert(response[1][3]); // showing "test1" }, error: function(err) { alert(err) } }); }
Comments
Post a Comment