代码:
readxml.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>测试返回XML格式的数据</title>
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/json2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
readxml();
});
function readxml(){
$.ajax("${pageContext.request.contextPath}/readxml",// 发送请求的URL字符串。
{
dataType : "text", // 预期服务器返回的数据类型。
type : "POST", // 请求方