var adserver = jsonadserver;
var adconfig = jsonadconfig;
$(adconfig)each(function(){
var temp = $(this);//这里是把数组里的每个对象取出来
alert(tempadid);
alert(tempadurl);
});var a=[{"list":[{"count":0,"createTime":"2008-01-25 00:00:00","createUserDept":"","createUserDeptId":"","createUserId":"","createUserName":"","deleteFlag":"0","introduction":"","month":"","pagerSize":0,"periodicalId":"","periodicalName":"admin","periodicalType":"","publishDate":null,"status":"0","updateUserDept":"","updateUserDeptId":"","updateUserId":"","updateUserName":"","year":""},{"count":0,"createTime":"2008-01-25 00:00:00","createUserDept":"","createUserDeptId":"","createUserId":"","createUserName":"","deleteFlag":"0","introduction":"","month":"","pagerSize":0,"periodicalId":"","periodicalName":"admin","periodicalType":"","publishDate":null,"status":"0","updateUserDept":"","updateUserDeptId":"","updateUserId":"","updateUserName":"","year":""}],"pageString":""}]
var list=a[0]list;
for(i=0;i<listlength;i++){
alert(list[i]count);
alert(list[i]createTime);
}
当数组处理,只是成员为对象var obj = {};
for(var k in obj) {
//遍历对象,k即为key,obj[k]为当前k对应的值
consolelog(obj[k]);
}var typeArr = new Array();
for(var i = 0;i<infoListlength;i++)
{
typeArrpush(infoList[i]type) //获取到type的值
for(var j = 0;j<infoList[i]typeListlength;j++)
{
var info = infoList[i]typeList[j];
alert(infoID);
alert(infostartDate);
alert(infoendDate);
alert(infoadultNum);
alert(infochildrenNUm);
}
}
这样就遍历出了所有的数据了
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)