$.ajax({
type: "POST",
url:"http://127.0.0.1/jk/xml.php",
data: "",
success: function(xml){
obj=$(xml).find("teacher");
alert(obj.text());//弹出内容 xuduowei
}
});
xml.php 接口 code:
<?php
$xmlstring=<<<XML
<?xml version="1.0" encoding="UTF-8"?>
<persons>
<student>xue</student>
<teacher>xuduowei</teacher>
</persons>
XML;
echo $xmlstring;
?>
关注公众号,了解更多it技术(it问答网)