说明:
请将以下蓝色部分代码,另存为:x.php
打开页面,即可看到ALERT内容

 

<?php
if (isset($_GET['x'])) {
header("Content-Type:text/xml");
die('

<?xml version="1.0" encoding="utf-8"
?>
<data>
  
<php email="RunMan@QQ.com">
     
<name>Young[夸父]</name>
  
</php>
  
<php email="tutuyu23@163.com">
      
<name>Anson</name>
  
</php>
  
<java email="xiayuanfeng1983@hotmail.com">
     
<name>Nicholas</name>
  
</java>
</data>

');
}
?>

 


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(
function() {
$.post(
"x.php?x",function(xml){
    $(xml).find(
"php").each(function(){
      alert($(
this).children("name").text());
      alert($(
this).attr("email"));
    });
}
)
})
</script>
</head>
</html>


 

posted on 2009-11-24 00:01  钱途无梁  阅读(1143)  评论(0编辑  收藏  举报