My HTML Code:
<form action="process.php" method="POST" class="appointment">
<input type="text" name="name" class="form-control" required="" placeholder="Adınız">
<input type="text" name="surname" class="form-control" required="" placeholder="Soyadınız">
<input type="text" name="phone" class="form-control" required="" placeholder="Cep Telefonunuz">
<input type="email" name="email" class="form-control" placeholder="eMail Adresiniz">
<select name="service" required="" class="form-control" onchange="getPersonnels(this.value);">
<option value="">1) Lütfen hizmet seçin</option>
<option value="1">Klinik Diyet</option>
<option value="2">Online Diyet</option>
<option value="3">Klinik Psikolojik Destek</option>
<option value="4">Online Psikolojik Destek</option>
<option value="5">Fitness</option>
</select>
<select name="personnel" required="" id="personnels" class="form-control" onchange="getPersonnelWorkingDays(this.value);">
<option value="">2) Lütfen önce hizmet seçin</option>
</select>
<select name="date" required="" id="personnel-date" class="form-control" onchange="getPersonnelWorkingDaysHours(this.value);">
<option value="">3) Lütfen önce danışman seçin</option>
</select>
<select name="clock" required="" id="personnel-date-hours" class="form-control">
<option value="">4) Lütfen önce gün seçin</option>
</select>
<input type="submit" name="create-appointment" value="Randevu Oluştur" class="btn btn-secondary py-3 px-4">
And my js:
<script type="text/javascript">
function getPersonnels(val) {
$.ajax({
type: "POST",
url: "/ajax.php?getPersonnels",
data:'service='+val,
success: function(data){
$("#personnels").html(data);
}
});
}
function getPersonnelWorkingDays(val) {
$.ajax({
type: "POST",
url: "/ajax.php?getPersonnelWorkingDays",
data:'personnel='+val,
success: function(data){
$("#personnel-date").html(data);
}
});
}
function getPersonnelWorkingDaysHours(val) {
$.ajax({
type: "POST",
url: "/ajax.php?getPersonnelWorkingDaysHours",
data:'personnel'+val,
success: function(data){
$("#personnel-date-hours").html(data);
}
});
}
</script>
ajax.php include:
<?
if(isset($_GET['getPersonnelWorkingDaysHours'])){
/* Test block, i'll code here when i catch the value */
<option><? echo $_POST['personnel']; ?></option>
}
?>
So you see, I want to catch value from name of "personnel" and id of "personnels", other functions are running when i request to the ajax page. But this function couldn't. I think this problem is caused by
data:'personnel'+val,
line of my js.
Whats your idea ? Thank you.