zoukankan      html  css  js  c++  java
  • Jquery同步载入数据

    function getItem()
    {
        var str= $.ajax({ url: "Exec.aspx?flag="+Variables, async: false }).responseText; 
        var dom=new ActiveXObject("Microsoft.XMLDOM");
        dom.loadXML(xml);                    
        var t=dom.getElementsByTagName("item");
        var menu=document.getElementById("Sele_City").options;
        menu.length=0;
        for(var i=0;i<t.length;i++)
        {
          menu.add(new Option(t[i].getAttribute("name"),t[i].getAttribute("id")));
        }

    }

    -----------------------------------------------------------
    <script runat="server">
        void Page_Load(object sender, EventArgs e)
        {     
            Response.ContentType = "text/xml";
            Response.Write("<menus>");
            Response.Write("<menu name=\"\" id=\"\" </menu>");
            DataTable dt =new DataTable();
            dt = (数据集);
            foreach(DataRow dr in dt.Rows)
            {
                 Response.Write("<menu name=\""+dr["name"].ToString()+"\" id=\""+dr["id"].ToString()+"\" </menu>");
            }
            Response.Write("</menus>";
        }
    </script>
  • 相关阅读:
    二维数组
    数组经典排序
    数组复制方法
    循环
    方法和包
    switch

    注释
    面向对象优点
    有参
  • 原文地址:https://www.cnblogs.com/snlfq2000/p/1037435.html
Copyright © 2011-2022 走看看