【发布时间】:2015-12-26 00:13:50
【问题描述】:
在我的 HTML 文件中,最后有以下代码:
<script type="text/javascript">
function voteUp(userID,userName,channelID,messageID,voteUp,voteDown)
{
$.get("_vote/vote_ajax.php?userID="+userID+"&userName="+userName+"&channelID="+channelID+"&messageID="+messageID+"&voteUp="+voteUp+"&voteDown="+voteDown, function(response){
// alert("Data: " + data + "\nStatus: " + status);
alert(response);
});
}
</script>
但我在加载 HTML 页面时出现错误:
XML 解析错误:格式不正确 位置:http://localhost/ajaxChat/ 第 626 行,第 55 列: $.get("_vote/vote_ajax.php?userID="+userID+"&userName="+userName+"&channelID="+channelID+"&messageID="+messageID+"&voteUp="+voteUp+"&voteDown="+voteDown, 函数(响应){ -------------------------------------------------- ------------^
如果我只使用一个参数,则 HTML 页面加载正常:
<script type="text/javascript">
function voteUp(userID,userName,channelID,messageID,voteUp,voteDown)
{
$.get("_vote/vote_ajax.php?userID="+userID, function(response){
// alert("Data: " + data + "\nStatus: " + status);
alert(response);
});
}
</script>
【问题讨论】:
-
什么是通过 XML 解析器运行 HTML 页面?你真的在使用 XHTML 吗?
-
console.log(userName),检索什么?
标签: javascript php ajax