Monday, October 24, 2016

Form Data Submission using JQUERY and AJAX

<script>
$(function(){
    $('#submitinfo').on('submit', function(e){
        e.preventDefault();
        $.ajax({
            url: "https://localhost/submit.php",
            type: 'POST', //or POST
            data: $('#submitinfo').serialize(),
            success: function(data){
                 alert('successfully submitted');
$('#submitinfo').hide();
            }
        });
    });
});
</script>

<form id="submitinfo">
<table>
<thead>
<h4 id="review-title">Customer information</h4>
</thead>
<tr>
<label class="control-label" for="input-name">Complete Name</label>
<input type="text" name="name" value="" id="input-name" class="form-control" required>
</tr>
<tr>
<label class="control-label" for="input-name">Phone Number</label>
<input type="text" name="guest_
</tr>
<tr>
<label class="control-label" for="input-name">Email Address</label>
<input type="text" name="email" value="" id="input-name" class="form-control" required>
</tr>
</table>
   <div class="modal-footer" STYLE="margin-top:30%;" >
       <button name="btn_submit" id="btn_submit" type="submit" class="btn btn-success">Submit</button>
   </div>
</form>