• 下拉框多级联动


    function getShelf(){
    var storageId = $("#location").val();
    //return alert(storageId);
    $.ajax({
    url:"${pageContext.request.contextPath}/asset/asset/getShelf?storageId="+storageId,
    type:"get",
    async:false,
    timeout:"1000",
    success:function(data){
    $("#shelvesId option").remove();
    $("#shelvesId").append("<option value='0'>--请选择--</option>");
    if (data != 0) {
    for ( var i = 0; i < data.length; i++) {
    var shelvesId = data[i].shelvesId;
    var shelname = data[i].shelname;
    $("#shelvesId").append("<option value="+shelvesId+">" + shelname + "</option>");
    }
    }
    },
    error : function(XMLResponse) {
    alert(XMLResponse.responseText);
    }
    });
    }

    服务端

    //查询获取id下货架
    @RequestMapping(value="getShelf")
    public String getShelf(HttpServletRequest reuqest, HttpServletResponse response) throws Exception{
    //格式
    response.setContentType("text/json; charset=UTF-8");
    //调用仓库并获取仓库ID
    String storageId = reuqest.getParameter("storageId");
    Integer id = Integer.parseInt(storageId);
    PrintWriter out = null;
    try{
    out = response.getWriter();
    }catch(Exception e){
    e.printStackTrace();
    }
    JSONArray array = new JSONArray();
    JSONObject member = null;
    try{
    //根据仓库的Id 来查找仓库下的所有货架信息
    LmShelvesExample shelvesExample = new LmShelvesExample();
    LmShelvesExample.Criteria criteria = shelvesExample.createCriteria();
    if (StringUtils.isNotEmpty(id.toString()) && !"0".equals(id)){
    criteria.andRemarksEqualTo(id.toString());
    }
    List<LmShelves> shelvesList = shelvesService.selectByExample(shelvesExample);
    for(LmShelves shelf:shelvesList){
    member = new JSONObject();
    member.put("shelvesId", shelf.getShelvesId());
    member.put("shelname", shelf.getShelname());
    array.add(member);
    }
    }catch(Exception e){
    e.printStackTrace();
    }
    out.print(array.toString());
    return null;
    }
  • 相关阅读:
    有限自动机的构造与识别
    c语言文法
    201506110097-试验一实验报告
    作业9.30
    组合数据类型练习,综合练习
    Python综合基础练习
    linux基本命令
    试述大数据对思维方式的重要影响
    语法分析
    有限自动机的构造与识别
  • 原文地址:https://www.cnblogs.com/gtbky/p/8242701.html
Copyright © 2020-2023  润新知