I am having a simple problem with my listener. So the following html is served up by Django upon reaching the homepage of my app:
<!DOCTYPE html>
{% load staticfiles %}
<html>
<head>
{% csrf_token %}
<title>Tempo</title>
<link rel="stylesheet" type="text/css" href="{% static "css/styles.css" %}">
<link rel="stylesheet" type="text/css" href="{% static "css/bootstrap.min.css" %}">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
$( "#myform" ).on( "submit", function( event ) {
console.log("This should fire after form submission")
});
$( "#myform" ).submit(function() {
console.log("This should fire after form submission")
});
</script>
</head>
<body>
<div id="header">
<img id="logo" src="{% static "img/logo_wt.svg" %}"/>
</div>
{% csrf_token %}
<form id="myform" action="/" method="POST" enctype="multipart/form-data">
{% csrf_token %}
<input type="file" name="csvFile">
<input type="submit" value="Submit">
</form>
</body>
I want to carry out a set of actions after the form is submitted, but for some reason I can't get the event listener to fire. I have tried both on
and submit
methods with no luck. Anyone know whats going on