How to Add data to database using simple AJAX
Step 1 : First we will create the form with username and details fields.Step 2 : Then create ajax code with in same page.
<script>
$(document).ready(function(){
$('#ajax-contact-form').submit(function(evt){
evt.preventDefault();
$.ajax({
type: "POST",
/*dataType: "json",*/
url: "add.php",
data: $('#ajax-contact-form').serialize(),
success: function(html){
if(html==1)
{
alert("Added successfully");
window.location="index.php"; 