I have this code in JSP
Map<String, Long> map = new HashMap<String, Long>();
map.put("A", 10L);
map.put("B", 20L);
map.put("C", 30L);
JSONObject json = new JSONObject();
json.accumulateAll(map);
System.out.println(json.toString());
List<String> list = new ArrayList<String>();
list.add("Sunday");
list.add("Monday");
list.add("Tuesday");
json.accumulate("weekdays", list);
System.out.println(json.toString());
It prints
Info: 2
Info: {"A":10,"B":20,"C":30}
Info: {"A":10,"B":20,"C":30,"weekdays":["Sunday","Monday","Tuesday"]}
In netbeans's ouput
my ajax is
var id = $(this).attr('data-id');
$.ajax({
type: 'POST',
url: '../include/residents.jsp',
dataType: "json",
data: {
id: id,
},
success: function(data) {},
error: function(data) {}
}).done(function() {
});
How can I show those ouput data in ajax success or done functions?