• MVC省市二级联动


    <script>
            $(function () {
                ShowSheng();
            })
            function ShowSheng() {
                $.ajax({
                    url: "/Home/Sheng",
                    type: "get",
                    dataType: "json",
                    success: function (da) {
                        $(da).each(function (index, item) {
                            $("#S1").append("<option value='" + item.Aid + "'>" + item.Aname + "</option>");
                        })
                    }
                })
            }
            function SelQu(t) {
                var m = $(t).val();
                $.ajax({
                    url: "/Home/Shi",
                    type: "get",
                    data: { id: m },
                    dataType: "json",
                    success: function (da) {
                        $("#S2").empty();
                        $(da).each(function (index, item) {
                            $("#S2").append("<option value='" + item.Aid + "'>" + item.Aname + "</option>");
                        })
                    }
                })
            }
        </script>
     
    <div>
    省市:<select id="S1" onchange="SelQu(this)"><option value="0">---请选择省市---</option></select>区镇:<select id="S2"><option value="0">---请选择区镇---</option></select>
    </div>
  • 相关阅读:
    Firefly是什么?有什么特点?
    windows7下启动mysql服务出现服务名无效
    win7系统64位eclipse环境超详细暗黑1.4服务器搭建
    Python安装模块出错(ImportError: No module named setuptools)解决方法
    Error format not a string literal and no format arguments解决方案
    DropFileName = "svchost.exe" 问题解决方案
    javascript
    Javascript
    PHP 命名空间namespace 和 use
    css
  • 原文地址:https://www.cnblogs.com/huosanpie/p/9999539.html
Copyright © 2020-2023  润新知