I'm currently using datatable in liferay portlet and i have to make ajax call and return a Json.
So in my controller i wrote :
@RenderMapping(params = "action=doAjaxSearch")
public String ajaxSearch(RenderRequest request, RenderResponse response, @RequestParam int iDisplayStart,
@RequestParam int iDisplayLength, @RequestParam String sEcho, Model model) {
model.addAttribute("sEcho", sEcho);
model.addAttribute("count", 20);
return AJAX_RESULT;
}
Where AJAX_RESULT is the view's name used to create my Json :
{ <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
"sEcho": , "iTotalRecords": ${count}, "iTotalDisplayRecords": ${count}, "aaData": [] }
Everything works fine but the response returned contains the json + liferay theme. I would like to just retrieve the jsp content.
Thanks in advance for your help guys.