Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
22
rated 0 times [  26] [ 4]  / answers: 1 / hits: 22531  / 13 Years ago, fri, june 17, 2011, 12:00:00

I am having problem with my jQuery function what I am trying to achieve is to populate data in a listbox



The JavaScript function



function load() {
$.getJSON('${findAdminGroupsURL}', {
ajax : 'true'
}, function(data) {
var html = '<option value=>Groups</option>';
var len = data.length;
for ( var i = 0; i < len; i++) {
html += '<option value=' + data[i].name + '>' + data[i].name
+ '</option>';
}
html += '</option>';

$('#selection').html(html);
});
}


The server side is



@RequestMapping(value = groups, method = RequestMethod.GET)
public @ResponseBody
List<Group> getGroups() {
return this.businessGroups();
}


I call load() function on load it triggers the function getGroups() and returns the list successfully but the problem is once the getGroups() is finished



function(data) doesn't load never gets into that function and the error is




org.springframework.web.HttpMediaTypeNotAcceptableException:
Could not find acceptable
representation




Can't I post back a list of Group objects, or does it have to be a Java primitive type?


More From » java

 Answers
33
[#91656] Thursday, June 16, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kalynnkathrynd

Total Points: 273
Total Questions: 101
Total Answers: 93

Location: Nauru
Member since Thu, Feb 2, 2023
1 Year ago
;