我想改變使用鏈接jQuery的負載不工作,重定向,而不是更新
我的HTML代碼來設置一個div內容:
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>
</head>
<body>
<a href="dashboard.html">dashboard</a>
<a href="basic-info.html">basic-info</a>
<div id="content"></div>
<script src="scripts/links.js" type="text/javascript"></script>
</body>
</html>
我的JS代碼:
//inside of links.js
// JavaScript Document
$(document).ready(function() {
$('#content').load("dashboard.html");
});
這應該工作。你是否點擊了''將內容轉換爲'div'? –
我的目標是獲得可點擊的鏈接:單擊時更新內容。 load()仍然不起作用。現在我想要使用dashboard.html來更新#content,這就是上面的內容。要回答你的問題 - 不,b/c我只想在這一點加載內容 –
*現在我想加載更新#content使用dashboard.html *:然後上述應該工作。檢查'dashboard.html'的路徑。試試'/ dashboard.html' –