<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index1</title>
<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script src="~/Content/themes/easyUI/jquery.easyui.min.js"></script>
<link href="~/Content/themes/easyUI/easyui.css" rel="stylesheet" />
<link href="~/Content/themes/easyUI/icon.css" rel="stylesheet" />
@Styles.Render("~/Content/css")
<script type="text/javascript">
$(document).ready(function () {
$('#list').click(function () {
alert("hello");
$('#page').load('Student/ListProjects');
alert("bye");
})
});
</script>
</head>
<body>
<div>
<button id="list">所有选题列表</button>
</div>
<div id="page">
ssss
</div>
</body>
</html>
源代码如下,点击按钮,却无法load。
前后2个alert都已调用,但是中间那句却没有用。
$('#page').load('/Student/ListProjects');
结果是ajax有缓存,每次改动后第一次能用,后面就不能用了。
@liesl: 个人习惯用$.ajax({}).done()这种完整的语法。如果load是缓存的话,那你只需要将url加上随机字符串就可以了。如$('#page').load('/Student/ListProjects?rnd=' + Math.round());
@幻天芒: 好办法,谢谢了
@liesl: :)
不是没有用,而是你load函数里面参数传错了啊。你load里面传入的是什么东西?
传入一个控制器动作