0
基本上,我创建了与链接类的多个链接,并且它们每个都有它们所代表的内容的标识。根据链接ID将内容加载到DIV中
我写了一个jQuery脚本,这不是为我工作,并抛出了第一个错误:
$(function() {
$.get('pages/home.html')
.success(function(response) {
$('.contentblock').html(response);
})
.error(function(jqXHR, textStatus, errorThrown) {
$('.contentblock').html('<h1>Failed to load page(s)!</h1>');
});
$(document).on('click', '.link', function() {
$('.contentblock').html('<div class="animatedload"></div>');
var page = 'pages/' + $(this).attr('id') + '.html';
$('.contentblock').hide();
$.get(page)
.success(function(response) {
$('.contentblock').html(response);
})
.error(function(jqXHR, textStatus, errorThrown) {
});
$('.contentblock').fadeIn(1000);
});
});
它扔.error(函数()){}在6号线。
请帮我解决这个:(感谢您的帮助提前
编辑:曾是服务器的问题,而不是代码:)
〜MCD
该错误只需要做的初始加载,而不是从点击虽然负荷,对不对?另外,我很确定你指定了错误的成功/加载函数,但我必须检查。 – 2013-04-06 05:57:16
啊,没关系,我只是没有看到指定处理函数的形式。无论如何,为什么不在输出中包含textStatus和errorThrown,以帮助您进行调试?不知道为什么它有错误的功能,它是不可能说明为什么它不起作用。 – 2013-04-06 05:59:41
它以前工作@crimson_penguin,但现在它似乎不太好,其相同的代码:s – madcrazydrumma 2013-04-06 06:20:18