您可以直接调用该对象,因为它已经加载到
obj_stage
{ "data": obj_stage["-flowState"] },
{ "data": "-flowState" },
并且只能通过使用数组的索引来访问数组
$(document).ready(function () {
var request = new XMLHttpRequest();
request.open("GET", "./test.json", false);
request.send(null)
var responseMain = JSON.parse(request.responseText);
var my_array = responseMain.feed.entry;
$("#totalnum").html(my_array.length);
var obj_stage = [];
$.each(my_array, function (index, value) {
obj_stage.push(value.content.F_Form1);
});
//if(my_array.length === obj_stage.length ){
$('#myTable').DataTable({
"data": obj_stage,
"columns": [
{ "data": "-flowState" },
{ "data": "-flowState" },
]
});
//}
});