0

基本上,我已经使用“链接”类创建了多个链接,它们每个都有一个代表它们的 id。

我写了一个 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);
    });
});

它在第 6 行抛出 .error(function()){} 。

请帮我解决这个问题:(提前感谢您的帮助!

编辑:是服务器问题,而不是代码:)

~MCD

4

1 回答 1

0

原来@crimson_penguin 是对的!

出于安全原因它不会工作,所以把它放到服务器上让它工作

于 2013-04-06T17:06:44.563 回答