我需要加载函数以从 HTML 文件中包含的外部 JS 获取数据,我正在这样做:
<body onLoad="getTicket();">
......
</body>
或这个:
<html>
<body>
<head>
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/functions.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
getTicket();
});
<script>
</head>
<body>
</html>
或这个:
<html>
<body>
<head>
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/functions.js" type="text/javascript"></script>
<script>
getTicket();
<script>
</head>
<body>
</html>
我在functions.JS中有这个:
functioOne() {
}
functionTwo() {
}
$(document).ready(function() {
...
.....
function getTicket() {
//to do
}
});
但不起作用并在控制台中显示:
Uncaught ReferenceError: getTicket is not defined
问候。