html代码
<select id="select" style="width : 80px;height : 30px;"> //下拉框数据动态加载 </select>
js代码
$.ajax({
url: "", //后台webservice里的方法名称
contentType: "application/json; charset=utf-8",
type: "get",
async : true ,
dataType: "json",
success: function (date) {
var optionstring = "";
for (var j = 0; j < date.length;j++) {
optionstring += "<option value=\"" + date[j].id + "\" >" +"睡眠次数:"+date[j].limitnumber+" 睡眠时间:"+date[j].sleeptime + "</option>";
$("#select").html("<option value='0'>请选择...</option> "+optionstring);
}
},
error: function (msg) {
alert("出错了!");
}
});
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END














暂无评论内容