Issue with browser buttons in Laravel Ajax pagination

106 Views Asked by At

when I go from the paginate(list page) page to the details page and after some time when I return to the previous page using the browser back button then break the actual design in Laravel Ajax pagination.

Here is my code

backend/pages/folder/list blade view

@extends('backend.layouts.default')
@section('content')
   <div class="panel panel-flat mbl-panel-list">
     a design section is here
     //Datatable start
     @if ($ComList->isEmpty())
            <div class="row">
              a design here
            </div>
        @else
            @include('backend/pages/journal/journalTable')
        @endif
   </div>
@stop

laravel return 
-----------------
if ($request->ajax()) {
     return view('backend/pages/folder/folderTable', compact($data))->render();
}else{
     return view('backend/pages/folder/list', compact($data));
 }
jquery ajax:
---------------

$('body').on('click', '.custom_pagination .pagination a', function(e) {
        e.preventDefault();
        var url = $(this).attr('href');//http://127.0.0.1:8000/admin/folder/list?page=4
    getArticles(url)
        window.history.pushState("", "", url);
    });

    function getArticles(url) {
        $.ajax({
            url : url ,
            method:'GET',
        })
    .done(function (data) {
            $(TableParentClass).html(data);         
        })
        
        .fail(function (error) {
            alert('Sorry, Your pagination could not be loaded.');
        });
    }

I want the actual design when i change the route paginate page to another page and return back previous spage by browser back button.

like theis image. actual design

when i click edit button and change the url then design is here. route change from paginate page

back button click then design break. break design

0

There are 0 best solutions below