This commit is contained in:
Ross
2021-02-01 12:20:48 +00:00
parent 7d3abd0680
commit 1fbc3b4bb8
8 changed files with 62 additions and 76 deletions
@@ -34,38 +34,4 @@
{% endfor %}
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
$("#annotation-json-toggle").click(() => { $("#annotation-json-content").toggle() });
// send request to change the is_private state on customSwitches toggle
$("#save-annotations").click(function () {
json = getJsonToolStateNoId();
$.ajax({
url: "{% url 'anatomy:question_save_annotation' pk=question.pk %}",
data: {
csrfmiddlewaretoken: "{{ csrf_token }}",
annotation: json,
},
type: "POST",
dataType: "json",
})
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
.done(function (data) {
console.log(data);
// show some message according to the response.
// For eg. A message box showing that the status has been changed
if (data.status == "success") {
toastr.info('Annotations saved')
} else {
toastr.warning('Error saving annotations')
}
})
.always(function () {
console.log('[Done]');
})
})
});
</script>
{% endblock %}