PHP + ajax +jquery 怎么实现页面加载完成前,提示页面正在加载

2025-06-22 21:31:18
推荐回答(1个)
回答1:

jsp代码


jquery代码
$("#typeId option").each(function(){
if($(this).val()=='${template.typeId}'){
$(this).attr('selected',true);
}
});

jquery中的${template.typeId}是页面加载时传过来的数据
${template.typeId}在不同的条件下可以有不同的传入方式,
比如html+jquery
其他代码都一样,你只需要ajax取得要用的值即可
比如jsp(freemarker)+jquery
和原文实例一样

jsp jquery 页面中select显示加载后的数据默认选中项