我正在使用Laravel5分页。我添加了一些ajax代码,因为当我点击下一个按钮时,我不需要刷新页面。
我的问题是,当我点击下一个按钮时,我的页面正在刷新。请帮我找到这个问题。我的代码和屏幕截图如下。
在firefox firebug控制台中显示一些错误" TypeError:Window.getDefaultComputedStyle的参数1不是对象。"
JS
#abilitytest:点击功能以在bootstrap模型中显示数据
$( "#abilitytest" ).click(function() {
$.post("/abilitytest", function(response){
$( "#abilityQuestions" ).html(response);
});
});
$('.pagination a').on('click', function (event) {
event.preventDefault();
var page = $(this).attr('href');
console.log(page);
alert('hai');
});
控制器
$abilitytests = Abilitytest::simplePaginate(1);
return view('test.abilitytestmodal',['abilitytests' => $abilitytests]);