0
第一个alert
如何显示Dublin
但第二个是undefined
?尝试访问json对象中的元素时未定义
http://jsfiddle.net/pzdx6L5a/1/
function getRenderParamValue(query){
customContext = JSON.parse("{\"test\":true,\"geo\":\"\",\"city\":\"Dublin\",\"categoryId\":\"\",\"categoryName\":\"\",\"productId\":\"\"}");
alert(customContext.city);
return customContext.query;
}
alert('city: ' + getRenderParamValue('city'));
这应该是'返回customContext [查询]'。 – Barmar 2014-09-04 22:56:22