This is some content of my Django template.
...
<a id="ID" href="">Do operation with database.<a/>
...
<script type="text/javascript">
window.onload = function () {
var a = document.getElementById("ID");
a.onclick = function () {
if (confirm("do you really want to perform task?")) {
/** call python function in order to perform some operations with database **/
}
return;
}
</script>
...
The function is for example(we can imagine the function is in views.py):
def performtask():
#do my operation with the database
My question is, how it is possibile to call performtask() function from the script tag in my template?