我开发了一个滑动页面站点,它只有一个索引页和4-5个由DIV id区分的不同的DIV部分,下面是链接:http://gosick.tk/。
姓名: 08093103002通行证:麦
但它需要相当长的时间来加载,因为整个网站只有一个页面,而整个页面实际上是9200 PX;
现在,当我一次单击菜单或请给我任何解决方案,以便在表单操作紧急时加快内容加载,我希望通过id=加载“明智的”AJAX。
发布于 2013-11-14 06:02:29
“现在我想用AJAX加载每个部门的数据”
$.ajax({
url: 'test.html',
dataType: 'html',
success: function(html) {
var div = $('#loadDivId', $(html)).addClass('classname');
$('#wheretoloadId').html(div);
}
});编辑:这只在您的div是ajax响应的一部分时才能工作?
发布于 2013-11-14 06:07:13
这将打开div内容中锚标记的链接。
<script>
$(document).ready(function() {
$('a').each(function(){
$(this).on("click",function(e) {
console.log(e);
e.preventDefault();
$('#content').load($(this).attr('href'));
});
});
});
</script>https://stackoverflow.com/questions/19970489
复制相似问题