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>

  • 相关阅读:
    robots.txt
    procdump和mimikatz工具配合破解windows账户口令
    通过vbs脚本控制方向盘按键
    批处理删除文件或文件夹代码
    彩色线条雨特效html代码
    secureCRT
    chrome 更新flash插件
    python命令行下安装redis客户端
    FastJson使用
    Redis 学习(二)
  • 原文地址:https://www.cnblogs.com/hc1020/p/5067220.html
Copyright © 2011-2022 走看看