<html>
<head>
<title>ajax example</title>
<script src="~/Scripts/jquery-1.7.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#btnajax').click(function (even) {
$('#div1').load("/javaScript/JQueryTest", { "resultType": "html" });
})
});
</script>
</head>
<body>
<button type="button" id="btnajax">使用ajax的onload</button>
<div id="div1"></div>
</body>
</html>
<head>
<title>ajax example</title>
<script src="~/Scripts/jquery-1.7.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#btnajax').click(function (even) {
$('#div1').load("/javaScript/JQueryTest", { "resultType": "html" });
})
});
</script>
</head>
<body>
<button type="button" id="btnajax">使用ajax的onload</button>
<div id="div1"></div>
</body>
</html>
本文介绍了一个简单的示例,展示如何使用jQuery的load方法通过Ajax请求从服务器加载内容到指定的HTML元素中。此过程不需要刷新整个页面。
1379

被折叠的 条评论
为什么被折叠?



