use*_*644 4 html javascript jquery
我有一个jquery函数,从php文件中检索数据,并将所有这些放入选择列表,这很好,问题是它需要一些时间来加载,我想在选择加载时显示加载文本,但它似乎不起作用,这是我尝试过的:
var modelSelect = $('[name="model"]'); // this is the select <select> list
$('[name="make"]').on('change', function(){ // another <select> that fires up the ajax
var chosen = $(this).val();
$.ajax({
type: "POST",
url: "process.php",
data: {'send': chosen},
beforeSend: function(){
modelSelect.html("loading"); //doesn't work
},
success: function(data){
modelSelect.html(data);
}
});
});
Run Code Online (Sandbox Code Playgroud)
任何想法我怎么能说它在那里装?
请改用此代码
modelSelect.html("<option> loading ... </option>");
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你.