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>

  • 相关阅读:
    tyvj1061Mobile Service
    POJ3666序列最小差值
    POJ2279杨氏矩阵+钩子定理
    POJ2127 LICS模板
    codevs2189数字三角形(%100)
    qhfl-7 结算中心
    qhfl-6 购物车
    qhfl-5 redis 简单操作
    qhfl-4 注册-登录-认证
    qhfl-3 Course模块
  • 原文地址:https://www.cnblogs.com/hc1020/p/5067220.html
Copyright © 2011-2022 走看看