I am struggling with an AJAX
call that should be returning a JSON
document
function fetchData() {
$.ajax({
url: '/x',
type: 'GET',
data: "json",
success: function (data) {
// code is missing
}
});
}
My server-side setup is very straightforward.
@RequestMapping(value = "/x", method = GET, produces = "application/json")
public @ResponseBody List<Employee> retrieveData() {
return employeeService.getEmployees();
}
Despite the simplicity of my server-side configuration, my request does not reach the controller. The error message I receive is:
HTTP Status 415 - The server rejected this request as the request entity is in a format not supported by the requested resource for the specified method.
Any ideas on how to resolve this issue?