wrap in function for correct behavior

This commit is contained in:
Pierre-antoine Comby 2020-03-24 23:27:08 +01:00
parent 9be93db9af
commit b3c1032f4f
1 changed files with 4 additions and 2 deletions

View File

@ -61,7 +61,7 @@ function search_field_moved(secondfield) {
// on click of button "delete" , call the API // on click of button "delete" , call the API
function delete_button(button_id){ function delete_button(button_id){
$.ajax({ $.ajax({
url:"/api/note/transaction/template/"+button_id, url:"/api/note/transaction/template/"+button_id+"/",
method:"DELETE", method:"DELETE",
headers: {"X-CSRFTOKEN": CSRF_TOKEN} headers: {"X-CSRFTOKEN": CSRF_TOKEN}
}) })
@ -69,7 +69,9 @@ function search_field_moved(secondfield) {
addMsg('{% trans "button successfully deleted "%}','success'); addMsg('{% trans "button successfully deleted "%}','success');
$("#buttons_table").load("{% url 'note:template_list' %} #buttons_table"); $("#buttons_table").load("{% url 'note:template_list' %} #buttons_table");
}) })
.fail(addMsg(' {% trans "Unable to delete button "%} #' + button_id,'danger' )); .fail(function(){
addMsg(' {% trans "Unable to delete button "%} #' + button_id,'danger' )
});
} }
</script> </script>
{% endblock %} {% endblock %}