select菜单实现二级联动

	
                执行人*
                
                    
                    
                    
                
	

function zxDwChange() {
        var bmid = $("#zxrDw").val();
        alert(bmid);
        $("#zxrId").empty();
        var text = "";
        $.post("${base}/zfjd/zxrList", {"bmid":bmid}, function(data) {
            if (data != "") {
                var dataArr = eval('(' + data + ')');
                for (var i in dataArr) {
                    text += "";
                }
                if (text == "") {
                    $("#zxrId").append("");
                } else
                    $("#zxrId").append(text);
            } else {
                $("#zxrId").append("");
            }
        });
    }

@Action("zxrList")
    public void zxrList() {
        try {
            if (request.getParameter("bmid").equals("")) {

            } else {
                Integer bmid = Integer.parseInt(request.getParameter("bmid"));
                zxr = policeMenService.getZxr(bmid);
                String json = "[";
                if (null != zxr && zxr.size() > 0) {
                    for (Map map : zxr) {
                        json += "{\"value\":\"" + map.get("id") + "\",\"title\":\"" + map.get("xm") + "\"},";
                    }
                    json = json.substring(0, json.length() - 1);
                }
                json += "]";
                super.renderText(json);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }










你可能感兴趣的:(JavaScript,jQuery)