This topic created in 4977 days ago, the information mentioned may be changed or developed.
例如有这样一个JSON
{
name : "v2ex",
age : "18",
location : {
city : "北京",
country : "中国"
}
}
在tmpl中如何获得location.city,因为loation不是数组,不能用each
8 replies • 1970-01-01 08:00:00 +08:00
 |
|
1
keakon Oct 5, 2012
你是要遍历map么
for (key in location) { console.log(key + ': ' + a.location[key])} }
|
 |
|
2
lisztli Oct 5, 2012
var response_json = $.parseJSON(respTxt);
|
 |
|
6
bitsmix Oct 6, 2012
template engine 还是用 {{mustache}} 吧。 另外,如果问题是 parseJSON 解决的就说明服务器传回来的 content-type 不对。 我的意思是你的问题其实还是没真正解决。
|