jQuery – Submitting a form with AJAX
26th February 2016 - jQuery
To submit a form with AJAX (without reloading the page), you can use the ajaxForm/ajaxSubmit functions from Ajax Form Plugin or the jQuery serialize function. AjaxForm: $(“#theForm”).ajaxForm({url: ‘server.php’, type: ‘post’}) or alternatively:- $(“#theForm”).ajaxSubmit({url: ‘server.php’, type: ‘post’}) ajaxForm will send when the submit button is pressed. ajaxSubmit sends immediately. Serialize Method: $.get(‘server.php?’ + $(‘#theForm’).serialize()) $.post(‘server.php’, $(‘#theForm’).serialize()) […]