我编写了一个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
答案 0 :(得分:0)
原来@crimson_penguin是对的!
出于安全原因,它无法正常工作,因此请将其放在服务器上以使其正常工作