Am getting a json data from servlet to JSP. Am getting the response from servlet checked in browser console. Attached the screenshot. I have given below the servlet and JSP code. Am making a ajax call to servlet to retrieve the json data. But from servlet response is coming but in ajax call its not going inside success function. How can i read this data in JSP and i need to use this JSON in javascript to retrieve it.
Am new to JSP & Servlet. I have tried this much. Can anyone help here please to read it and retrieve in JSP?
Thanking in Advance
Servlet Code
response.setContentType("application/json");
response.setHeader("cache-control", "no-cache");
PrintWriter out = response.getWriter();
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json);
out.println(json.toString());
out.flush();
JSP Code with AJAX Call
$.ajax({
url: '<%=request.getContextPath()%>/home',
type: 'POST',
data: {
'action': 'getBugReport',
'dateString':document.getElementById("daterangePicker").value,
'projectName': 'All'
},
success: function(responseText) {
},
error: function () {
}
Response from Servlet