zoukankan      html  css  js  c++  java
  • 二级联动

    
    
    function getdormid() {
            alert(11);
            var id=$("#id").val();
            $.get("${path}/dorm?method=JSONDormList",{id:id},function(data){
                var str="";
                $.each(data, function(i, obj) {
                    alert(obj.remaining_number);
                    if(obj.remaining_number!=0){
                        str += "<option value="+obj.id+">" + obj.code + "</option>";
                    }
                });
                $("#dorm").html(str);
            }, "json");
            
        }
        <tr>
                <td>宿舍编号:</td><td>
                <select name="id" id="id" onchange="getdormid()">
                    <option value="0">男</option> 
                    <option value="1">女</option> 
                </select>
                <select name="dorm" id="dorm" >
                    <option></option> 
                </select>
            </tr>
    // 查询宿舍集合
        private void getJSONDormList(HttpServletRequest request, HttpServletResponse response) {
            //调用方法
            String id= request.getParameter("id");
            List<Dorms> dormList=studentService.getJSONDormList(id);
            System.out.println(dormList.size()+"成都");
            Object jsonList = JSON.toJSON(dormList);
            PrintWriter out;
            try {
                out = response.getWriter();
                out.print(jsonList);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
  • 相关阅读:
    【NOIP2003提高组】加分二叉树
    【luogu1220】关路灯
    【luogu2583】地铁间谍
    Hello, World!
    python中的画笔控制函数
    python中库引用与import
    python中RGB色彩
    turtle角度坐标体系
    turtle空间坐标系
    python中turtle库的使用
  • 原文地址:https://www.cnblogs.com/JBLi/p/10479397.html
Copyright © 2011-2022 走看看