jquery ajax get form vields value on submit code example
Example: jQuery AJAX form submit
// jQuery ajax form submit example, runs when form is submitted
$("#myFormID").submit(function(e) {
e.preventDefault(); // prevent actual form submit
var form = $(this);
var url = form.attr('action'); //get submit url [replace url here if desired]
$.ajax({
type: "POST",
url: url,
data: form.serialize(), // serializes form input
success: function(data){
console.log(data);
}
});
});