Hello to everybody,
I have a table page where I want to edit and delete my objects. Edit is working whitout any problem.
I have a problem with delete method.
The button is inside a list and this is the code:
<li>
<a onclick="return deleteSchema('{{row.id}}')" class="btn-trash">
<i class="fas fa-trash-alt"></i> {% endverbatim %}{{translate("DELETE")}}{% verbatim %}
</a>
</li>
And this is deleteSchema function used to call my delete method but everytime I have error CSRF code was invalid
<script type="text/javascript">
function deleteSchema(arg1){
$.ajax({
type: "DELETE",
url: "{{site.uri.public}}/formgenerator/"+arg1,
success: function (response) {
window.location.reload();
},
error: function (xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
console.log(err);
}
});
}
</script>
Can anyone help me ?