I am new to laravel, I have got a task of inserting pagination in bootstrap tabs. There are 2 tabs both tabs contain data which are different from each other. There may be 100 records in 1 tab and 10 in other, so it does not match.
I have been searching on the net to find an example which helps to crack this issue of paging. I inserted pagination but when I click on paging link other tab also gets affected and also it reloads the main page rather than the particular tab.
Please help me in solving this issue. Thanks in advance.
Ajax code for pagination is below
$(window).on('hashchange', function() {
if (window.location.hash) {
var page = window.location.hash.replace('#', '');
if (page == Number.NaN || page <= 0) {
return false;
}else{
getData(page);
}
}
});
$(document).ready(function()
{
$(document).on('click', '.pagination a',function(event)
{
$('li').removeClass('active');
$(this).parent('li').addClass('active');
event.preventDefault();
var myurl = $(this).attr('href');
var page=$(this).attr('href').split('page=')[1];
getData(page);
});
});
function getData(page){
$.ajax(
{
url: '?page1=' + page1,
type: "get",
datatype: "html",
})
$.ajax(
{
url: 'dashboard',
type: "get",
datatype: "html",
data:{name:'newLeads'},
})
.done(function(data)
{
$("#item-lists").empty().html(data);
location.hash = page;
})
.fail(function(jqXHR, ajaxOptions, thrownError)
{
alert('No response from server');
});
}
enter code here