Answer the question
In order to leave comments, you need to log in
How to store click count in django server?
Django project.
There is a button, clicks on it are shown in the paragraph:
<button class="button_p" onclick="doCount()"><h1 style="color: #331c2a">Choose</h1></button>
<p>Всего попыток: <span id="count"></span></p>
function doCount() {
var count = document.getElementById('count');
count.innerHTML = +count.innerHTML + 1;
}
Answer the question
In order to leave comments, you need to log in
def function(request):
return JsonResponge({"clic":mymodel.objects.last().clic})
def someinput(request,message):
m = mymodel(clic=message)
m.save()
Make the appropriate urls, and fetch url someinput on button click, and fetch function on page load, and model mymodel with clic (int) field
Alternatively, a form will be sent when clicked. Or the user's response from above
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question