如何读取所有值?关键是“任务”,价值如下。
{"Assignments":[{"AssignedBy":"537000","AssignedBy_FirstName":" JOHN","AssignedBy_LastName":"WANDER"},
{"AssignedBy":"537000","AssignedBy_FirstName":" JOHN","AssignedBy_LastName":"WANDER"}],
"Comments":[{"CommentBy":"537000","CommentBy_FirstName":"JOHN"}, {"CommentBy":"537000","CommentBy_FirstName":" JOHN"}],
"Result":"SUCCESS",
"Tasks":[{"ACT_ARR":"05/20/2013 05:59:00 PM","ACT_DPT":"","ARR_FLT":"0434/20","ARR_GATE":"25"}],
"TasksCurrentStatus":[],
"Updated":"05/30/2013 02:54:09 PM"}
我试过 ....
$(document).ready(function() {
var alltask = localStorage.getItem('Task');
var single = alltask.getJSON('Assignments');
var acnum = '';
var obj = $.parseJSON(single);
$.each(obj, function(i, val){
acnum += val.AssignedBy + " ";
});
alert(acnum);
});
但结果是:
找不到作业
看起来我没有正确读取 JSON 标记