I'm trying to create a progress bar using this libary.
But I'm getting this error on the most basic example:
Uncaught TypeError: Cannot read property 'success' of undefined at r.fn.init.e.fn.ajaxSubmit (jquery.form.js:171) at HTMLFormElement.t (jquery.form.js:1026) at HTMLFormElement.dispatch (jquery-3.2.1.slim.min.js:3) at HTMLFormElement.q.handle (jquery-3.2.1.slim.min.js:3)
This is my code:
<head>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha256-k2WSCIexGzOj3Euiig+TlR8gA0EmPjuc79OEeY5L45g=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.form/4.2.2/jquery.form.min.js" integrity="sha384-FzT3vTVGXqf7wRfy8k4BiyzvbNfeYjK+frTVqZeNDFl8woCbF0CYG6g2fMEFFo/i" crossorigin="anonymous"></script>
<script>
$(document).ready(function() {
$('#fileUploadForm').ajaxForm(function() {
alert("Thank you for your comment!");
});
});
</script>
</head>
<body>
<form id="fileUploadForm" method="POST" enctype="multipart/form-data">
<input type="file" name="files[]" multiple>
<input type="submit" value="Prenesi">
</form>
</body>
Your error tells you the exact line in your script where the error is being thrown. You have no success function. Change your code to this and it should work: