.
This commit is contained in:
@@ -21,40 +21,10 @@
|
||||
{% block js %}
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#delete-selected-button").on("click", function () {
|
||||
answer_ids = [];
|
||||
$("tbody input:checked").each((n, el) => {
|
||||
answer_ids.push(el.value);
|
||||
})
|
||||
|
||||
if (confirm(`Delete ${answer_ids.length} answers?`)) {
|
||||
$.ajax({
|
||||
url: "{% url 'anatomy:user_answer_delete_multiple' %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
answer_ids: JSON.stringify(answer_ids) // true if checked else false
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
|
||||
if (data.status == "success") {
|
||||
toastr.info('Deleted.')
|
||||
location.reload();
|
||||
} else {
|
||||
toastr.info('Error deleting questions.')
|
||||
|
||||
}
|
||||
// show some message according to the response.
|
||||
// For eg. A message box showing that the status has been changed
|
||||
})
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
}
|
||||
$("#delete-selected-button").on("click", () => {
|
||||
window.delete_multiple(
|
||||
"{% url 'anatomy:user_answer_delete_multiple' %}", "{{ csrf_token }}"
|
||||
)
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -21,40 +21,10 @@
|
||||
{% block js %}
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#delete-selected-button").on("click", function () {
|
||||
answer_ids = [];
|
||||
$("tbody input:checked").each((n, el) => {
|
||||
answer_ids.push(el.value);
|
||||
})
|
||||
|
||||
if (confirm(`Delete ${answer_ids.length} answers?`)) {
|
||||
$.ajax({
|
||||
url: "{% url 'rapids:user_answer_delete_multiple' %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
answer_ids: JSON.stringify(answer_ids) // true if checked else false
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
|
||||
if (data.status == "success") {
|
||||
toastr.info('Deleted.')
|
||||
location.reload();
|
||||
} else {
|
||||
toastr.info('Error deleting questions.')
|
||||
|
||||
}
|
||||
// show some message according to the response.
|
||||
// For eg. A message box showing that the status has been changed
|
||||
})
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
}
|
||||
$("#delete-selected-button").on("click", () => {
|
||||
window.delete_multiple(
|
||||
"{% url 'rapids:user_answer_delete_multiple' %}", "{{ csrf_token }}"
|
||||
)
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -21,40 +21,10 @@
|
||||
{% block js %}
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#delete-selected-button").on("click", function () {
|
||||
answer_ids = [];
|
||||
$("tbody input:checked").each((n, el) => {
|
||||
answer_ids.push(el.value);
|
||||
})
|
||||
|
||||
if (confirm(`Delete ${answer_ids.length} answers?`)) {
|
||||
$.ajax({
|
||||
url: "{% url 'sbas:user_answer_delete_multiple' %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
answer_ids: JSON.stringify(answer_ids) // true if checked else false
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
})
|
||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||
.done(function (data) {
|
||||
console.log(data);
|
||||
|
||||
if (data.status == "success") {
|
||||
toastr.info('Deleted.')
|
||||
location.reload();
|
||||
} else {
|
||||
toastr.info('Error deleting questions.')
|
||||
|
||||
}
|
||||
// show some message according to the response.
|
||||
// For eg. A message box showing that the status has been changed
|
||||
})
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
}
|
||||
$("#delete-selected-button").on("click", () => {
|
||||
window.delete_multiple(
|
||||
"{% url 'sbas:user_answer_delete_multiple' %}", "{{ csrf_token }}"
|
||||
)
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user