my ajax request dose not work do not know why
here is my html and ajax code :
<form name="myForm" id="formy" action="" method="post" class="form-horizontal" >
<div class="form-control-group">
<label style= "font-family: cursive;
font-size: 15px;
color: #0e0e62;" class="control-label" for="firstname">First Name</label>
<div class="controls">
<input placeholder="Enter Your First Name pls" type="text" value="" class="input-xlarge" name="fname" id="firstname"></div>
</div>
<div class="form-control-group" >
<label class="control-label" for="secondname"> Second name</label>
<div class="controls">
<input value="" type="text" class="input-xlarge" name="sname" id="secondname" placeholder="Enter Your Second Name pls" ></div>
</div>
<div class="form-control-group" >
<label class="control-label" for="tele">tele-phone Number</label>
<div class="controls">
<input value="" type="text1" class="input-xlarge" name="telnum" id="tele" placeholder="Enter Your Tele_phone number pls" ></div>
</div>
<div class="form-control-group" >
<label class="control-label" for="cele">Cell-phone Number</label>
<div class="controls">
<input value="" type="text1" class="input-xlarge" name="celnum" id="cele" placeholder="Enter Your Cell-phone number pls" style= "font-family: cursive;
font-size:17px"></div>
</div>
<div class="form-control-group" >
<label class="control-label" for="dateb" > Birth Date</label>
<div class="controls">
<input value="" type="date" name="date" class="input-xlarge" id="dateb" required></div>
</div>
<div class="form-control-group" >
<label class="control-label" for="addres" > Address</label>
<div class="controls">
<textarea placeholder="Enter YourFull Address pls" style= "font-family: cursive;
font-size:12px" required="" value="" class="input-xlarge" name="address" id="addres" ></textarea></div>
</div>
<div class="form-actions" >
<button id="addy" type="submit" class="btn btn-success btn-large" onClick = "return validate(this)">Send</button>
<button type="reset" class="btn">Reset</button></div>
<span id="span"></span>
<script>
function(){
$("#addy").click(function(e){
e.preventDefault();
$.ajax({
URL:"insert.php",
type:"post",
data:("#formy").serialize(),
dataType:'text',
success:function(d) {
$("#span").text(d);
$("#formy")[0].reset();
}
});
});
};
</script>
</form>
and here is my insert.php code :
<?php
session_start();
?>
<html>
<link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.min.css"/><link rel="stylesheet" href="bootstrap-3.3.7-dist/js/bootstrap.min.js"/><link rel="stylesheet" href="bootstrap-3.3.7-dist/fonts/bootstrap.min.css"/>
<link rel="stylesheet" href="bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<body>
<?php
$mysqli = new mysqli("localhost", "root", '',"db103");
$stmt = $mysqli->prepare("INSERT INTO telephone_guide(owner,firstName ,secondName,phonenumber,celnumber,birth, adress) values ( ?,?,?,?,?,?,?)");
$stmt->bind_param("sssssss",$owner,$firstName,$secondName,$phonenumber,$celnumber,$birth,$adress);
$owner=$_SESSION['myname'];
$firstName=$_POST['fname'];
$secondName=$_POST['sname'];
$phonenumber=$_POST['telnum'];
$celnumber=$_POST['celnum'];
$birth=$_POST['date'];
$adress=$_POST['address'];
$stmt->execute();
$stmt->close();
?>