DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> AJAX入門 >> AJAX詳解 >> Jquery同步之載入數據
Jquery同步之載入數據
編輯:AJAX詳解     

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>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved