0
我用Javascript,JQuery和ajax编写的测试程序有点问题。JSON解析问题jquery,ajax
这是我的代码:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Index</title>
<script src="https://code.jquery.com/jquery-2.1.1.js"></script>
<script src="script.js"></script>
</head>
<body>
<button> Push here </button>
</body>
</html>
JS
$(document).ready(function(){
$('button').on('click',function(e){
callPage()
})
});
function callPage(){
$.ajax({
url: "http://events.restdesc.org/",
type: "GET",
dataType:'json',
succes: function (response) {
var data = response;
console.log("hey");
console.log(data.title);
},
error: function(error){
console.log("the page was not loaded", error);
},
});
}
但是如果我检查网络,我看到我的要求,但 我不获得成功,所以控制台不记录任何东西。 这怎么可能?
错字在 “成功”? – joaofs
哦不,我一直在寻找这个好几个小时,这并没有显示webstorm中的任何错误 – fangio
@fangio在“成功”中的错字仍然会产生错误,即使他们没有被记录。 –