I have a problem, while I am trying to use ajax function I am getting the following message: TypeError: $.ajax is not a function.
In the same project on another page AJAX function call work fine but in this page it doesn't work.
I am using in both pages with the same header
<!doctype html>
<html lang= "he">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="../CSS/mainCSS.css">
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
</head>
<body dir ="rtl">
<button type="button" class="btn btn-primary" id = "singUpBtn">singup</button>
<button type="button" class="btn btn-primary" id = "loginBtn" >Login</button>
<script>
$('#loginBtn').click(function(){
$.ajax({
type:"POST",
url:"registration.php",
data:$('#regForm').serialize(),
success:function(result){
if(result == 1){
window.location.assign("../Pages/page1.php");
}else{
$('#regAlert').html(result).show();
}
}
})
})
$('#singUpBtn').click(function(){
$.ajax({
type:"POST",
url:"registration.php",
data:$('#singUpForm').serialize(),
success:function(result){
if(result == 1){
window.location.assign("../Pages/page1.php");
}else{
$('#singUpAlert').html(result).show();
}
}
})
})
})
</script>
</body>
</html>
I don't understand why on my other page page1.php the ajax call work fine but on my main page it doesn't.
what I am doing wrong?
I will be thankful for any help.
Aucun commentaire:
Enregistrer un commentaire