How to get JSON response in jQuery Ajax in Spring Mvc? this is my ajax code
$.ajax({
type: 'POST',
url: "fetch",
dataType: 'json',
data: {clientidedit:clientidedit},
success: function(data) {
},
error: function(jqXHR, textStatus, errorThrown) {
alert("error");
}
});
here is my service. this will return a string.How can i get each data in ajax response?
if (StringUtils.isEmpty(clientId)) {
resObj.put("clientId", org.json.JSONObject.NULL);
} else {
resObj.put("clientId", clientId);
}
if (StringUtils.isEmpty(clientName)) {
resObj.put("clientName", org.json.JSONObject.NULL);
} else {
resObj.put("clientName", clientName);
}
array.put(resObj);
}
try {
resObjForTable.put("aaData", array);
} catch (JSONException ex) {
Logger.getLogger(SabbServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
}
return resObjForTable.toString();
Thanks in advance....