zoukankan      html  css  js  c++  java
  • ajax动态刷新下拉框

    动态post,避免直接给页面传输大量数据

    /**
    	 * ajax通过商品刷新供应商
    	 * by_kangyx
    	 * @throws IOException 
    	 */
    	@RequestMapping(params = "actionMethod=refreshGoodRefSuppliers",method = RequestMethod.POST)
    	public void refreshGoodRefSuppliers(final Model model,
    			final HttpServletRequest request, final HttpServletResponse response) throws IOException{
    		//定义返回字符串
    	    StringBuffer strBuffer = new StringBuffer("");
    		String goodId = request.getParameter("goodId");
    		strBuffer.append("<option value=''>---请选择---</option>");
    		List<GoodRefSuppliers> goodRefSuppliersList = baseSupplierService.getGoodRefSuppliers(Long.valueOf(goodId));
    		for(int i=0;i<goodRefSuppliersList.size();i++){
    			strBuffer.append("<option value ='"+goodRefSuppliersList.get(i).getSuppliers().getId()+"'>"+goodRefSuppliersList.get(i).getSuppliers().getName()+"</option>");
    		}
    		Util.printString(response, strBuffer.toString());
    	}
    
                                    <td>
    			        <select name="goodRefSuppliers" id="goodRefSuppliers_${s.index}"
    			        onchange="setSuppliers(this.value,${orderdetail.id});" 
    			        onkeydown="refreshGoodRefSuppliers(${orderdetail.prdInfo.goodsInfo.id},${s.index});"
    			        onmousedown="refreshGoodRefSuppliers(${orderdetail.prdInfo.goodsInfo.id},${s.index});">    
    			        <option value="">--请选择--</option>
    			        </select>
    			         </td>
    
    	function refreshGoodRefSuppliers(id,ip){
    		switchData('logisticsOrders.do?actionMethod=refreshGoodRefSuppliers&goodId='+id,'',function(data,flag){
    			if(flag==1){
    				if(data!=""){
    					$("#goodRefSuppliers_"+ip).empty().append(data);
    	
    				}
    			}
    		});
    	} 
    
  • 相关阅读:
    线程基础之进程,线程,任务
    Jobs深入学习
    Quartz的API简介及Jobs和Trigger介绍
    Quartz入门及简单实现
    maven仓库配置阿里云镜像
    Activiti图表bpmn对应的xml文件
    Activiti流程设计工具
    Activiti的25张表
    subprocess.Popen指令包含中文导致乱码问题解决
    Qt5.9使用QWebEngineView加载网页速度非常慢,问题解决
  • 原文地址:https://www.cnblogs.com/kyxyes/p/3650343.html
Copyright © 2011-2022 走看看