我有这段代码:
$(document).ready(function () {
$.getJSON('http://localhost:5000/', function (response) {
console.log(response);
});
});
localhost:5000是一个flask/python
脚本,返回一个类似于json
的对象:
{
"data": [
0,
0,
0,
我得到的结果是:
$.getJSON is not a function TypeError: $.getJSON is not a function
有什么建议可以帮我开始理清混乱的情况吗?
谢谢!
编辑:
HTML:
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"></script>
<script src="lib/main.js"></script>
</head>
<body>
</body>
</html>
lib/main.js
是包含 document.ready
的位置。
谢谢!
jQuery
,要么在此之前你调用了jQuery.noConflict()
(这意味着从那时起你必须使用jQuery
而不是$
)。 - Adam Jenkins