One of the problems I am experiencing at the moment is not being able to call a function in the onclick event of the submit button.
First, you should avoid inline handlers like that. Second, depending on the form submission process. You should have the button inside your tags. Then add .
Otherwise, use jQuery and $.ajax() with a click event handler:
$('#submit').on('click', () {
$.ajax({check properties in jquery api docs}, (result) => {
// do something
},
(e) => {
// do something on error
})
})