jquery ajax submit form on button click code example
Example 1: jQuery AJAX form submit
$("#myFormID").submit(function(e) {
e.preventDefault();
var form = $(this);
var url = form.attr('action');
$.ajax({
type: "POST",
url: url,
data: form.serialize(),
success: function(data){
console.log(data);
}
});
});
Example 2: jquery enable submit button
$("#submitButtonID").prop('disabled', true);
$("#submitButtonID").prop('disabled', false);
$("#submitButtonID").attr('disabled','disabled');
$("#submitButtonID").removeAttr('disabled');