script.blade.php
1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<script>
$(document).ready(function() {
console.log('load script...');
var block_show = false;
function scrollMore() {
var $target = $('#showmore-triger');
if (block_show) {
return false;
}
console.log('function ScrollMore');
if (true) {
var page = $target.attr('data-page');
page++;
block_show = true;
$.ajax({
type: "GET",
url: "{{ url()->full()}}",
data: "page=" + page,
dataType: 'html',
success: function (data) {
$('#showmore-list').append(data);
block_show = false;
}
});
$target.attr('data-page', page);
if (page == $target.attr('data-max')) {
$target.remove();
}
}
}
$(document).on('click', '#showmore-triger', function () {
console.log('click paginate...');
scrollMore();
});
});
</script>