JQuery Example
Screen shot
jQuery Form
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){

$("button").click(function(){

// Accept user input value
var name=$("input[name=name]").val();
var email=$("input[name=email]").val();

// Post Value to submitback.php and store in database
$.ajax({
type:"POST",
url: "submitback.php",
data: {"name":name,"email":email},
success: function(result){
$("#div1").html(result);
$("#name").val("");
$("#email").val("");
}
});
// $.ajax function end here

});
});
</script>
</head>
<body>
<div id="div1"></div>
Name<input id="name" name="name" type="text" value=""><br>
Email<input id="email" name="email" type="text" value=""/><br>

<button>Submit</button>

</body>
</html>

To Insert data into database
<?php
$server="localhost";
$username="root";
$password="";
$database="test";

$conn = mysqli_connect($server,$username,$password,$database);
if(!$conn){
die("MySQL Not Connected");
}

$name=$_POST['name'];
$email=$_POST['email'];
$query="insert into info set name='$name',email='$email'";
$result=mysqli_query($conn,$query);

if($result)
echo"Record insert";
else
echo"Record not insert";

mysqli_close($conn)
?>

You can download source code here