1๐
โ
you can use jquery to easily make an ajax request
as part of the event handler that is triggered by a user clicking โXโ, you can make a request to your django app.
$.post('/django/url/to/your/view', {idToDelete: 'value'}, function(response) {
// callback
});
Of coures this is just on the client side. In django you will need to creat a new urls.py entry and create the view logic to handle actually deleteing the id.
It is very important to include a csrf token in your post requests. Django provides step by step on how to do this with ajax requests. https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax
๐คdm03514
Source:stackexchange.com