I am trying to return a map from my spring controller to ajax call. its working fine, but i am getting the response in a string. how to get the values from ajax response?? my code...
In Controller..
> Map<String, Object> uploadFile(MultipartHttpServletRequest request,
> @RequestParam String projectCode, HttpServletResponse response,
> FileUploadJQ fujq, UserMaster um) {
> ..............
> ..............
> fileUploadJQRepo.save(fujq);
> System.out.println("ID::" + fujq.getFileId());
> long fileId = fileUploadJQRepo.findByFileNameAndCreatedDate(fujq.getFileName(),
> fujq.getCreatedDate()).getFileId();
> Map<String, Object> returnVal = new HashMap<String, Object>();
> returnVal.put("upFileId", fileId);
> returnVal.put("url", "<a href='/fileD/fileId/" + fileId + "'>" + fujq.getFileName() + "</a>");
> return returnVal;
ajax...
success: function(data) {
var percentVal = '100%';
bar.width(percentVal)
percent.html(percentVal);
var d="["+data+"]";
<c:forEach items="d" var="sa" varStatus="idx">
alert(${idx.index})
</c:forEach>
$('#result').html(data);
},
in browser i can see the data as...
"{"upFileId":97,"url":"<a href='/fileD/fileId/97'>manifest.json</a>"}"
so how to get the value against upFileId
and url
??
Plz help...
Thank you.