How to show List on form jeko 4545 Select in Ajax jQuery –
Step – 1: First know el create fgfggdata bghggase table named “course_list” given as bellow –
- In this expamle, blfgkvflg fgfgmf g we create tghlkgh loh,ghlgh we select course type then all related course name show in other dropdown box accodring to selected “id” in ajax.

Step 2: Create database connection file named “connectiondb.php” –
flgkfglf klfg f,g kfogl fgkpjifgmfg 454245544
flgfmglkfg fdgkflgkflkg fgkjfkjgfjg
fkgfkgjfkg okfgflmgkfjgfg
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "testDatabase";
hgthghgh
ghl;ghklkghgh
die("Connection failed: " . $conn->connect_error);
}
?>Step – 3 : Create Dropdown list –
<?php
include("connectiondb.php");
?>
<!doctype html>
<html>
<head>
<title>Show List on Select in Ajax Jquery</title>
<script src="https://codeloveguru.com/master-library/js/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#coursetype").change(function () {
var ctype = $(this).val();
if(ctype){
$.ajax({
type: 'POST',
url: 'ajaxprocess.php',
data: {coursetype: ctype},
success: function (data) {
$('#coursename').html(data);
},
error: function () {
console.log("error");
}
});
} else {
$('#coursename').html('<option value="">--- Select ---</option>');
}
});
});
</script>
</head>
<body>
<p>
<labelghgh
<label for="coursename">Course Name : </label>
<select name="coursename" id="coursename">
<option value="">--- Select ---</option>
</select>
</p>
</body>
</html>

Step – 4 : Create ajax & PHPPP file named “ajaxprocess.php” ffgfkgf system hell given as bellow –
<?php
include("connectiondb.php");
$ctype = isfgbvfgfgfg
fglfgfklgf
fg;kflgkfgfg
$resdatas) > 0) {
$sub_caste_data='<option value="">--- Select ---</option>';
while($rowD = mysqli_fetch_assoc($resdatas)) {
$sub_caste_data .= '<option value="'.$rowD["id"].'">'.$rowD["course_name"].'</option>';
}
echo $sub_caste_data; exit;
}
?>Show List on Select in goal file question Ajax jQuery

