Here is the code for combobox
<select name="cmbdegree" id="cmbdegree" class="styledselectevents">
<option value="0">Select Degree</option>
<?php
$newque="SELECT * FROM degrees";
$qu=mysqli_query($conn, $newque);
while($rs=mysqli_fetch_array($qu))
{
?>
<option value="<?=$rs['id']?>" <?php if($rs['id'] === $rsSemDegID) { echo 'Selected'; } ?>><?=$rs['Title']?></option>
<?PHP } ?>
</select>
Now I have a JQuery to run on the change
$(document).on('change', '#cmbdegree', function() {
var val = $(this).val();
$.ajax({
url: 'gettotalsemesters.php',
data: {
cmbdegree: val,
seldeg: $rsSemDegID
},
type: 'GET',
dataType: 'html',
success: function(result) {
$('#SemsterNum').html();
$('#SemsterNum').html(result);
},
error: function() {
alert('Error occured');
}
});
});
It works when user changes it .. but I want it to raise the change event when the selection has been done by PHP script.