f-angi
1/15/2016 - 4:41 PM

Posts a json to a Spring Resource through ajax

Posts a json to a Spring Resource through ajax

  $.ajax({
      type: "POST",
      url: $('#form-documenti').data('file-delete-url'),
      data: {
          fileId: $(file._removeLink).data('file-id')
      },
      success: function(data, status, xhr) {
          console.log(data);
          console.log(status);
      },
      error: function(data, status, xhr) {
          console.log(data);
          console.log(status);
      }
  });
@ResourceMapping("fileDelete")
public void fileDelete(ResourceRequest request, ResourceResponse response, @RequestParam String fileId) throws IOException {
  response.getWriter().write("{\"result\":\"ok\"}");
}