populate dropdown using jquery ajax code example
Example: populate dropdown using jquery from database
Use a string to store your option, and then append it to the select tag. Then, please check that data is there in the val.
$.getJSON("get-data.php?dat=driver",function(data){
var stringToAppend = "";
$.each(data,function(key,val) {
stringToAppend += "<option value='" + val.id + "'>" + val.id + "</option>";
});
$("#night_Shift_text").html(stringToAppend);
});