var json = [{
"id": "702",
"nid": "1",
"node_count": "211",
"sdata": "100",
"stype": "1",
"timestamp": "2014-04-04 09:00:42"
}][{
"id": "697",
"nid": "2",
"node_count": "218",
"sdata": "0",
"stype": "1",
"timestamp": "2014-04-0 4 08:41:05"
}][{
"id": "700",
"nid": "3",
"node_count": "217",
"sdata": "0",
"stype": "1",
"timestamp": "2014-04-04 08:41:52"
}][{
"id": "699",
"nid": "4",
"node_count": "33",
"sdata": "0",
"stype": "1",
"timestamp": "2014-0 4-04 08:41:46"
}][{
"id": "701",
"nid": "5",
"node_count": "23",
"sdata": "0",
"stype": "1",
"timestamp": "2014-04-04 08:42:20"
}]
$.each(json, function (arrayID, SensorData) {
alert('Node id' + SensorData.nid);
alert('SensorData' + SensorData.sdata);
alert('Sensor Type' + SensorData.stype);
alert('Time is ' + SensorData.timestamp);
});
-3
A
답변
0
찾고있는 json은 다음과 같아야합니다.
var json = [{
"id": "702",
"nid": "1",
"node_count": "211",
"sdata": "100",
"stype": "1",
"timestamp": "2014-04-04 09:00:42"
},
{
"id": "697",
"nid": "2",
"node_count": "218",
"sdata": "0",
"stype": "1",
"timestamp": "2014-04-0 4 08:41:05"
},
{
"id": "700",
"nid": "3",
"node_count": "217",
"sdata": "0",
"stype": "1",
"timestamp": "2014-04-04 08:41:52"
},
{
"id": "699",
"nid": "4",
"node_count": "33",
"sdata": "0",
"stype": "1",
"timestamp": "2014-0 4-04 08:41:46"
},{
"id": "701",
"nid": "5",
"node_count": "23",
"sdata": "0",
"stype": "1",
"timestamp": "2014-04-04 08:42:20"
}];
+0
나는이 방법을 얻지 못합니다. – sanjeev
+0
이 링크를 참조하십시오. http://jsfiddle.net/KEYU/1/ – Saddamhussain
+0
나는 이미 테스트했으나 내 json 데이터는 다음과 같이 제공되지 않았습니다. 당신이 제안한 것 – sanjeev
귀하의 구문은 완전히 유효하지 않습니다. 또한 문제에 대한 설명과 달성하려는 내용은 * 많은 * 도움이 될 것입니다. –
Rory 당신이 데이터를 검색하는 방법을 도와주세요. – sanjeev