1
我想从选项标签组合框的数据库中追加值。但是当我第一次选择标签的值为空,然后通过AJAX
追加时,它只显示一个值。但我希望所有选项都可见,但应自动选择。在jquery mobile中动态选择组合框
我的代码
$('#b').on("click", "a", function() {
var patid= $(this).attr('id');
$.ajax({
type:"GET",
url:"https://localhost/patient_details1.php?patid="+patid,
dataType:'JSON',
success:function(response)
{
("#pat_type").html("");
for (var i=0;i<response.length;i++)
{
$('<option value="'+ response[i].pattype +'">'+
response[i].pattype +'</option>').appendTo("#pat_type");
}
}
}
});
});