【发布时间】:2015-07-04 06:26:02
【问题描述】:
我有这个代码:
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<title>Test</title>
<script type="text/javascript" src="http://www.roblox.com/games/getgameinstancesjson?placeId=1818&startindex=0&jsonp=processResults"></script>
<script>
function parseResults(results) {
alert('success');
}
</script>
</head>
<body>
</body>
</html>
当我运行它时,它出现了一个错误: Uncaught SyntaxError: Unexpected token :
我已经查过了,但所有的解决方案都是用 JQuery 的。我没有使用 JQuery;我正在使用“传统”JSONP。
我该如何解决这个问题?
提前谢谢你。
【问题讨论】:
-
您将不得不发布响应的内容,因为这就是问题所在。
-
jsonp 和 jquery 并不是真正可比的东西
-
你确定是
parseResults()。您的 JSONP 回调是processResults()
标签: javascript html jsonp