标签:
和上一篇博客的问题类似
url:http://localhost:7778/project?member=[{id:1},{id:2}]
使用req.query.member获得参数member的值
var member = req.query.member; console.log(member);//[{id:1},{id:2}] for(var i in member){ console.log(member[i].id);//undefined }打印了一下 typeof member ,发现member的类型是String
使用eval函数将其转换为数组就可以了
var member = eval(req.query.member); for(var i in member){ console.log(member[i].id);//输出1,2 }
标签:
原文地址:http://blog.csdn.net/stellar1993/article/details/45225479