var obj = {"status":1,"bkmsg":"\u6210\u529f","bkdata":["\u5415\u5c1a\u5fd7","1387580400","\u6dfb\u52a0\u8bb0\u5f55"]}{"status":1,"\u6dfb\u52a0\u8bb0\u5f55"]},{"status":1,"\u4ec0\u4e48\u4e5f\u6ca1\u6709"]}
//===================================================================
ajax请求:
$.ajax({ url: '/path/to/file',type: 'GET',dataType: 'json',data: {param1: 'value1'},success: function (obj){ //遍历obj } })
返回的内容在success的函数里面,所有的遍历操作都是在这里面操作的:
for循环:
var obj = { "status":1,"bkmsg":"\u6210\u529f","bkdata":["\u5415\u5c1a\u5fd7","\u6dfb\u52a0\u8bb0\u5f55"] } console.log(obj.length); if (obj.status == 1) { for (var i = 0; i < obj.bkdata.length; i++) { console.log(obj.bkdata[i]); }; }else{ alert("数据有误~"); };