Answers for "js form serialize"


jquery serialize

var datastring = $("#contactForm").serialize();
    type: "POST",
    url: "your url.php",
    data: datastring,
    dataType: "json",
    success: function(data) {
        //var obj = jQuery.parseJSON(data); if the dataType is not specified as json uncomment this
        // do what ever you want with the server response
    error: function() {
        alert('error handling here');
Posted by: Guest on September-24-2020

js form serialize

var form = document.querySelector('form');
var data = new FormData(form);
Posted by: Guest on April-15-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language