日期:2014-05-16 浏览次数:20323 次
w= "{query:'m',suggestions:['a','b','c'],data:['1','2','3']}"; out = response.getWriter(); out.print(w);
return w;
@RequestMapping(value = { "/ajax/", "/ajax" }, method = RequestMethod.GET) @ResponseBody public Map<String, Object> load(@RequestParam(value = "query") String name) { Map<String, Object> map = new HashMap<String, Object>(); map.put("query", name); map.put("suggestions", suggestions); map.put("data", data); return map; }
a = eval("(" + b + ")")
a=b;
var dataObj=eval("("+data+")");//转换为json对象
alert(eval("{}"); // return undefined alert(eval("({})");// return object[Object]
data =(new Function("","return "+json))();