I'm trying to use AJAX to load a URL that will return data from my controller, I need the data to be JSONArray but when it makes the call I get a 406 not acceptable error. Is there an yway that I can return this with @ResponseBody? I can't seem to find a solution online. I've already added the Jackson dependency to my project.
My AJAX call:
$.ajax({
url : '/TeamBravo/graphs/dimple/WEEK',
success : function(data) {
var dataForDimpleWeek = data;
}
});
My Controller:
@RequestMapping("/dimple/{timeScale}")
@ResponseBody
public JSONArray getDimpleData(@PathVariable("timeScale") String timeScale){
JSONArray tweetsForDimple = new JSONArray();
if(timeScale.equals("WEEK")){
tweetsForDimple = getGraphWeekData(); //Returns JSONArray
}else if(timeScale.equals("MONTH")){
tweetsForDimple = getGraphMonthData();
}
return tweetsForDimple;
}
any help would be most appreciated, thanks.