AJAX Coding

jQuery AJAX Submit Form

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>jQuery AJAX Submit Form</title>
<script src=""></script>

<form id="form1" method="post">
    <input type="text" id="name[1]" name="value" value="aaa">
    <input type="submit"  class="update_form"  value="Update">

<form id="form2" method="post">
    <input type="text" id="name[2]" name="value" value="bbb">
    <input type="submit"  class="update_form"  value="Update">

// class of the submit button
$(".update_form").click(function() {
           type: "POST",
           url: "",
           data: $(this).parent().serialize(),
           success: function(data) {
               alert(data); // show response from php script.
    return false; // avoid to execute actual form submission.

Comments are closed.