// First upload the XML file
<? XML version = "1.0" encoding = "UTF-8" ?> < Info > < User ID = "1" > < Name > Tao guorong </ Name > < Sex > Male </ Sex > < Email > Tao_guo_rong@163.com </ Email > </ User > </ Info >
<! Doctype html > < Html Xmlns = "Http://www.w3.org/1999/xhtml" > < Head > < Meta HTTP-equiv = "Content-Type" Content = "Text/html; charsets = UTF-8" /> < Title > </ Title > < Script Type = "Text/JavaScript" SRC = "Scripts/jquery-1.7.1.min.js" > </ Script > < Script Type = "Text/JavaScript" > $ ( Function () {$ ( " # Button1 " ). Click ( Function () {$. Get ( " Userinfor. xml " , Function (Data) {$ ( " # Divtip " ). Empty (); // First clear the marked content VaR Strhtml = "" ; $ (Data). Find ( " User " ). Each ( Function (){ VaR $ Struser = $ ( This ); Strhtml + = " Name: " + $ Struser. Find ( " Name " ). Text () + " <Br/> " ; Strhtml + = " Gender: " + $ Struser. Find ( " Sex " ). Text () + " <Br/> " ; Strhtml + = " Email: " + $ Struser. Find ( " Email " ). Text () + " <Br/> " ;}); $ ( " # Divtip " Pai.html (strhtml); // display });});}) </ Script > </ Head > < Body > < Input Type = "Button" ID = "Button1" Value = "Ajax asynchronous loading of Data" /> < Div ID = "Divtip" > </ Div > </ Body > </ Html >
// Effect:
Note: