ajax中获得处理接口传过来的xml

$.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问答网

发表评论

电子邮件地址不会被公开。