It's been a while since I did Django and I found an example of calling a view from a button that I needed:
How do I call a Django function on button click?
I built my template to match the example given:
<html>
<head>
<title>Tournament Registration</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
function register() {
alert("Hi")
}
</script>
</head>
<body>
<p>{{ tournament.name }}</p>
<p>Start time: {{ tournament.start_time }}</p>
<button onclick="register">Register</button>
</body>
</html>
At first I just wanted it to pop an alert box so I know it's working at all. When I click the button however, nothing happens, and I get no error message in console. Am I able to call script tags in a Django template, or am I doing something else wrong here?