我正在使用freetexthost.com来存储我的json代码.. 现在我已经从url中使用javascript,jquery,ajax获取这些内容... bt无法获取它.. 正在尝试下面的代码使用javascript从外部网址获取内容
<!DOCTYPE html>
<html>
<head>
<title>Useless</title>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.11.0.min.js'></script>
<script type="text/javascript">
$.ajax({
type: "GET",
url: "http://freetexthost.com/r56ct5aw03",
dataType: "jsonp",
success: function(data){
console.log(data);
}
});
</script>
</head>
<body>
<div class="content" >Hello</div>
</body>
</html>
得到一个错误为'未捕获的SyntaxError:意外的标记<
有没有我们可以用JS操纵其他网页(URL)中的任意内容机会...
您有未封闭' “'管线'URL:” https://开头的http:// freetexthost.com/r56ct5aw03,'假设它作为错字 – Satpal
未捕获的SyntaxError:意外令牌<此当json解析器试图解析html时通常会出现错误 – SajithNair
使用你的浏览器网络检查器,jsonp没有被返回。如果你在浏览器中使用真正的url,你会在html页面看到原始的json或json吗? –