我创建了一个小型HTML页面,其中调用了jquery
库,但我得到了Uncaught ReferenceError: $ is not defined
。
代码是:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<script type="text/javascript">
$(document).ready(function(){
$.get('fetch.php/adds/3',function(data) {
$('#div-adds').html(data);
});
});
</script>
</head>
<body>
</div>
<div id="parent-container">
<div class="middle-cont" id="result-div">
<div class="left-panel">
<div id="div-restaurants"></div>
</div>
<div class="right-panel">
<div id="div-adds"></div>
</div>
</div>
</div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js" type="text/javascript"></script>
</html>
有什么想法吗?
由于
答案 0 :(得分:3)
订购问题。执行代码后加载库?将订单更改为
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$.get('fetch.php/adds/3',function(data) {
$('#div-adds').html(data);
});
});
</script>