moved code into functions refreshTable() and submitForm() and calling it from $(document).ready()