How can i access the HashMap
key to the JQuery
? I want to have the key it self to use in typeahead
of bootstrap.
I'm using Gson to parse the HashMap to 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 ) );
Code of my typeahead:
$('#textbox').typeahead({
source: function(query, process){
return $.get('URL', {query: query},
function(data){
return process(data.key);
},'json');
},
items: 10
});
at return process(data);
i want to have the key of the HashMap it self