I am building a web app in spring MVC.
I want to retrieve List of patient (collection) using Ajax. But it throws me error of 406 not acceptable
Jsp File
$(document).ready(function () {
$.ajax({
url: 'searchPatient',
//data: "uhid=" + $("#uhid").val() + "&type=" + $("#type").val(),
contentType: 'application/json',
dataType: 'json',
success: function (data) {
alert(data);
}
});
});
** Controller File
@RequestMapping("/searchPatient")
public @ResponseBody List<String> getPatient()
{
List<String> s = new ArrayList<String>();
s.add("hello");
return s;
}
How can I solve this error?