zoukankan      html  css  js  c++  java
  • 如何根据Jquery实现两级联动

    <script language="javascript" type="text/javascript" >
    $(function (){
          $.ajax({
                url:<select:link page="/tobaccoinfo.do?method=getBrandList" />,
                type: "get" ,
                dataType: "json" ,
                success: function (result){
                       var str="<option value=''>全部</option>" ;
                       for (var i=0;i<result.length;i++){
                            str+= "<option value="+result[i].id+">"+result[i].name+ "</option>" ;
                      }
                      $( "#brandid" ).html(str);
                }
          });
          $( "#brandid" ).change( function(){
                 var brandid=$("#brandid" ).val();
                $.ajax({
                      url:<select:link page="/tobaccoinfo.do?method=getTobaccoName" />,
                      type: 'get' ,
                      data:{
                             'brandid' :brandid
                      },
                      dataType: 'json' ,
                      success: function (result){
                             var str="<option value=''>全部</option>" ;
                             for (var i=0;i<result.length;i++){
                                  str+= "<option value="+result[i].id_+ ">"+result[i].name_+ "</option>" ;
                            }
                            $( "#tobaccoId" ).empty().html(str);
                      }
                });
          });
    });
    </script>

    <body>卷烟品牌:<select:select property="brandid" addspacerow="false" style="100px" ></select:select>
    卷烟名称:<select:select property="tobaccoId" addspacerow="false" style="120px" ></select:select></body>

  • 相关阅读:
    MyKTV项目总结
    TCP滑动窗口Sliding Window
    TCP时间戳选项Timestamp
    TCP窗口扩大选项Window Scale
    TCP最大报文段长度MSS
    TCP路径MTU发现
    TCP主动打开 之 第一次握手-发送SYN
    TCP层accept系统调用的实现分析
    Linux TCP套接字选项 之 SO_REUSEADDR && SO_REUSEPORT
    TCP层bind系统调用的实现分析
  • 原文地址:https://www.cnblogs.com/hc1020/p/5067220.html
Copyright © 2011-2022 走看看