怎么在jQuery中利用Ajax读取XML数据
作者
怎么在jQuery中利用Ajax读取XML数据?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
具体如下:
<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="JqueryAjax_Default"%>www.jb51.netjQuery使用ajax获取xml $(document).ready(function(){ $("#Display").click(function(){ $("#message").html(''); $.ajax({ type:"GET", url:"Friend.xml", dataType:"xml", success:function(ResponseText){ vartable=" "; $(ResponseText).find('friend').each(function(){ varfirst=$(this).find('firstName').text(); varlast=$(this).find('lastName').text(); varcity=$(this).find('city').text(); table+=" firstname lastname city "; }) table+=""; $("#message").append(table); } }); }); }); "+first+" "+last+" "+city+"