【发布时间】:2016-01-28 05:25:48
【问题描述】:
我正在使用 Laravel5 分页。我添加了一些 ajax 代码,因为当我单击下一步按钮时,我不需要刷新页面。
我的问题是当我单击下一步按钮时,我的页面正在刷新。请帮我找到这个问题。我的代码和屏幕截图如下。
在 firefox firebug 控制台显示一些错误“TypeError: Argument 1 of Window.getDefaultComputedStyle is not an object.”
js #abilitytest:在引导模型中显示数据的点击功能
$( "#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]);
【问题讨论】:
-
.pagination a是#abilityQuestions中的一个元素吗?#abilitytest是<a>标签吗?你看到你的console.log或alert了吗?提到的 TypeError 似乎与您在此处发布的代码无关。
标签: javascript jquery twitter-bootstrap laravel laravel-5