I want to know how to iterate a JSON object using jQuery. My requirement is I am getting a list from a Java Servlet to the UI and I have to populate a combo box with the AJAX response.
The above tack I already did it using struts2 and jQuery. Now I am in the middle of nowhere, how to iterate the Java List back in JSP:
$("#XXX option").remove();
$.each(data.YYYList, function(index, item) {
$("#XXX").append($("<option></option>").text(item).val(item));
});
I have set the MIME type as response.setContentType("application/json");
Can any one please guide me how to achieve this. Please let me know if any other information is needed from me.