form serialize in jquery code example
Example 1: jquery serialize
var datastring = $("#contactForm").serialize();
$.ajax({
type: "POST",
url: "your url.php",
data: datastring,
dataType: "json",
success: function(data) {
},
error: function() {
alert('error handling here');
}
});
Example 2: how to serialize form data in jquery
$("button").click(function(){
$("div").text($("form").serialize());
});
Example 3: js form serialize
var form = document.querySelector('form');
var data = new FormData(form);