jQuery的Java HashMap键
如何访问jQuery的Java HashMap键,java,jquery,twitter-bootstrap,Java,Jquery,Twitter Bootstrap,如何访问JQuery的HashMap键?我想要它自己的钥匙,以便在的typeahead中使用 我正在使用Gson解析Gson的哈希映射: HashMap<String, String> source = new HashMap<String, String>(); put("key","value"); response.setContentType( "application/json" ); response.setCharacterEncoding( "UTF-8
JQuery
的HashMap
键?我想要它自己的钥匙,以便在的typeahead
中使用
我正在使用Gson解析Gson的哈希映射:
HashMap<String, String> source = new HashMap<String, String>();
put("key","value");
response.setContentType( "application/json" );
response.setCharacterEncoding( "UTF-8" );
response.getWriter().write( new Gson().toJson( source ) );
at
返回过程(数据)代码>我想让HashMap的键自己为什么它很有可能
just use JSON.stringfy(data.key);
您可能需要处理(数据)
,因为映射是根JSON元素。但是请注意,这样我只能返回1个值数组?我尝试了data.key,因为我希望它返回键而不是值。这不可能吗?不,你不能从ajax调用中返回任何东西。我不明白你说的“钥匙”是什么意思。尝试查看的输出。我明白了,我将搜索一个工作环境
just use JSON.stringfy(data.key);