Answers for "When the form's submit button is clicked, append the text input's current value to the form message. jqurey"

15

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);
         }
    });
});
Posted by: Guest on July-25-2019

Code answers related to "When the form's submit button is clicked, append the text input's current value to the form message. jqurey"

Code answers related to "Javascript"

Browse Popular Code Answers by Language