I'm working with Django
in a project and I need to execute some functions depending on what user's want to do. If this action has to return and show new values I know how to do it, but when I just want to execute a function in my views.py
that I don't need any response and don't know how to do it.
Now what I'm doing is return something and don't use it, but I'm sure it is possible do it without returning anything.
My code that returns a response is:
$('#import_btn').click(function(){
updateData()
});
function updateData(filt){
console.log('Hello');
var csrftoken = $("[name=csrfmiddlewaretoken]").val();
$.ajax({
url: '/../../updateBBDD/',
type: 'POST',
headers:{"X-CSRFToken": csrftoken},
data: {
'Filt': filt,
},
dataType: "json",
cache: true,
success: function(response) {
var cols = response.Cols;
}
});
}
How I have to do it in my js
to execute a python function with no response??
Thank you very much.