permaculture playing cards*
The moose likes HTML, CSS and JavaScript and the fly likes jQuery : How can I iterate over Java HashMap<Long,String> into Javascript? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "jQuery : How can I iterate over Java HashMap<Long,String> into Javascript?" Watch "jQuery : How can I iterate over Java HashMap<Long,String> into Javascript?" New topic
Author

jQuery : How can I iterate over Java HashMap<Long,String> into Javascript?

Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 498
I am returning HashMap<Long,String> from server on one of the Ajax calls. How can I iterate over the it to extract key,value pair?

Thank you
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

How is it being returned? As JSON? Something else? A response must be text so you cannot be returning the actual list.

Using $.getJSON()? Something else?

We need more details.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 498
Thanks Bear.

It is being returned as an associative array and I was able to access through a simple for loop.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

Now there's a blast from the past. The term "associative array" is pretty antiquated -- and rightfully so, it isn't very accurate as what it describes isn't any sort of array. The better term to use is object hash.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jQuery : How can I iterate over Java HashMap<Long,String> into Javascript?
 
Similar Threads
Ordered and Sorted
Custom JSP Tag
retrive Vector from HashMap
how to show map of maps in jsp,struts
using c:forEach to iterate over Map<String, ArrayList<Hashmap>>