jsp页面ajax同步加载select标签内容

<li>
    <select id="p_select" name="p_select" onchange="">
    </select>
</li>
<script>
var data=$.ajax({url:"/theme/shop/warehouse.jsp", async:false});        			
$("#p_select").html("");
$("#p_select").html(data.responseText);
</script>

warehouse.jsp

<%@ page language="java" import="java.util.*,com.renesola.framework.obj.*,com.renesola.framework.db.*,com.renesola.framework.util.*,com.renesola.web.obj.*,com.renesola.web.dao.*,com.renesola.web.util.*,com.renesola.shop.obj.*,com.renesola.shop.dao.*,com.renesola.shop.util.*" pageEncoding="UTF-8"%>
<%
long country_id =StringUtil.getParam(request, "country_id", 1);
long importwarehouseid =StringUtil.getParam(request, "importwarehouseid", 0);
List<IObj> warehouseList = WarehouseSQL.getInstance().doQueryByCountryId(country_id);
if (!StringUtil.isEmpty(warehouseList)) {
	for (int i = 0; i < warehouseList.size(); i++) {
		WarehouseObj obj = (WarehouseObj) warehouseList.get(i);
		if(obj != null){
%>
<option value="<%=obj.getId() %>" <%if(obj.getId()==importwarehouseid){ %>selected="selected"<%} %>><%=obj.getName() %></option>
<% } } }else{ %>
<option value="">have no warehouse</option>
<%  } %>

相关推荐