Delete database record with ajax+spring boot+Thymeleaf

Asked

Viewed 351 times

-1

Good afternoon! I am trying to delete an item in my view, which is in a bootstrap table. I am using Thymeleaf + bootstrapna frontend. The idea is to take the id and move to a modal window of the bootstrap and through the modal delete the registration in the database. But I’m unable to pass the id to the ajax function to delete the record. Can anyone help me? x.x

Follow the code snippets ->

https://hastebin.com/acuyikufum.xml

1 answer

0

In case you haven’t solved it yet, I did so see if it helps.

$('#confirmacaoExclusaoModal').on('show.bs.modal', function(event) {
var button = $(event.relatedTarget);

var Codigo = button.data('codigo');
var Nome = button.data('nome');

var modal = $(this);
var form = modal.find('form');
var action = form.data('url-base');
if (!action.endsWith('/')) {
    action += '/';
}
form.attr('action', action + Codigo);

modal.find('.modal-body span').html('Tem certeza que deseja excluir :  

<strong>' + Nome + '</strong>?');
});
  • Thanks, I will test as soon as possible. Sorry the delay to view. As soon as I test I give a feedback. Thanks!!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.