vandan's avatar
Level 13

laravel pagination without page reload works?

hello i m confuse for i want data without page reload on laravel paginate method in default laravel pagination is working with page reload when click on next page but i want without page reload its pagination working so its possible or not ?

0 likes
2 replies
Sinnbeck's avatar

Do you mean using javascript? If not using javascript the whole page will re-render

vandan's avatar
Level 13

@Sinnbeck yes its using javascript i have some code but its not getting any kind of data only blank page reload.

here is my blade file code

{!! $events->appends(Request::except('page'))->render() !!}

here is my script file

	$('.page-link').on('click', function(e){
        	e.preventDefault();
        	//var url = $(this).attr('href');
        	var page = $(this).attr('href').split('page=')[1];
        	console.log(page);
        	fetchData(page);
    	});

	function fetchData(page){
    	$.ajax({
        	url: '/event?page='+page,
        	success:function(data){                
            	$("#mainCard").append(response.html);
            	$("#pagination").empty();
            	$("#pagination").append(response.pagination);
        	}
    	});
	}

Please or to participate in this conversation.