不知道哪错了
来源:2-7 利用Ajax实现新闻列表
weixin_慕瓜9083905
2020-01-05 18:06:17
Uncaught SyntaxError: Unexpected token '{'
报错{} 检查没错啊
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<div id="container"></div>
<script>
var xmlhttp;
if(window.XMLHttpRequset){
xmlhttp=new XMLHttpRequset();
}esle{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","/ajax/news_list",true);
xmlhttp.send();
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4&&xmlhttp.status==200){
var text=xmlhttp.responseText;
console.log(text);
}
}
</script>
</body>
</html>
1回答
好帮手慕酷酷
2020-01-05
同学你好,代码完成的不错但还有一点小问题,
1、else编写错了,具体如下:
2、XMLHttpRequest拼写错了,应该是est,具体如下:
如果我的回答解决了你的疑惑,请采纳!祝学习愉快!
相似问题