【发布时间】:2015-08-17 22:04:59
【问题描述】:
我有一个问题如下:
<script>
$(document).ready(function(){
$.ajax({
url: "https://api.domain.com/message.asp",
type: "POST",
cache: false,
contentType: "text/xml",
dataType: "text",
data : "<?xml version=\"1.0\"?>
<mainbody>
<header>
<company>companyName</company>
<usercode>323423</usercode>
<password>543543543</password>
<startdate>010120150100</startdate>
<stopdate>170820150100</stopdate>
<type>1</type>
</header>
</mainbody>
",
crossDomain:true,
success: function(result){
alert(result);
},
error: function(result) {
console.log(result);
}
});
});
</script>
在上面的代码中,以 xml 标签开头的行返回语法错误如下: Uncaught SyntaxError: Unexpected token ILLEGAL 这里有什么问题?
【问题讨论】:
标签: jquery ajax xml xmlhttprequest