首页 > 代码库 > freemarker 展示数据列表并传值给后台
freemarker 展示数据列表并传值给后台
select id="initiatorId" name="initiatorId">
<#if initiatorId == ‘-1‘ || initiatorId == ‘‘>
<option value="http://www.mamicode.com/-1" selected = "selected">全部</option>
<#else>
<option value="http://www.mamicode.com/-1">全部</option>
</#if>
<#if initiatorList?exists && initiatorList??>
<#list initiatorList as initiatorList>
<option value="http://www.mamicode.com/${initiatorList.initiatorId}" <#if "${initiatorList.initiatorId}"==initiatorId>selected="selected"</#if>>${initiatorList.initiatorName} </option>
</#list>
</#if>
</select>
传值给后台
var initiatorId = $(‘#initiatorId‘).val();
var initiatorName = $("#initiatorId option:selected").text();
$(‘#initiatorName‘).val(initiatorName);
freemarker 展示数据列表并传值给后台