[英]how run document ready in external file js
我有一個用於在外部文件js中選擇數據的功能
function show_all() {
work = "select";
$.ajax({
type: "POST",
url: "server.php",
data: "work="+work,
success: function(data) {
$("#boxtop").html(data);
$('#boxtop').animate({
scrollTop: $('#boxtop').get(0).scrollHeight}, 0);
}
});
}
並在html索引中記錄就緒工作,但不在外部文件js中工作
$(document).ready(function(e) {
show_all();
});
如果我理解正確,則需要將此行添加到index.html
<script type="text/javascript" src="yourscript.js"></script>
在頭部分的src中,您應該在其中放置外部文件的路徑
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.