Я хочу собрать данные из контроллера в ajax и показать их модалам JSP, когда нажата кнопка редактирования. Но я получил ошибку 500.
симуляция. jsp
<button class="btn btn-primary btn-edit" data-id="${simulasis.id}">Update</button>
Admin. js
$(document).ready(function () {
$('.table .btn-edit').on('click', function (event) {
event.preventDefault();
var id = {'id': $(this).attr('data-id')};
$.ajax({
url: '/backoffice/edit',
data: id,
contentType: "application/json",
dataType: "json",
type: 'GET',
success: function (response) {
$('#idEdit').val(response.id);
console.log("success");
},
error: function (jqxhr) {
console.log(this.url);
console.log(response);
}
});
console.log(id);
$('#edit-modal-lg').modal();
});
});
BackofficeController. java
@RequestMapping(value = "/edit", method = RequestMethod.GET, produces = "application/json")
@ResponseBody
public Simulasi getById(@RequestParam("id") int id){
return simulasiService.getSimulasi(id);
}
И я получил такую ошибку,