`$(document).on('formId', 'submit', handlerFunction);`. Then you can write the handler function separately, and not as an anonymous spaghetti function. Also better to be explicit and use a form id.