javascript - maintain ajax pagination upon clicking back button in Laravel 5.3 application -


i'am making use of laravel pagination($data->links()) ajax pagination using below code.

$(document).on("click", '.pagination a', function(e) {     e.preventdefault();     var url = $(this).attr('href');     loadarts(url); });  function loadarts(url) {     $.ajax({         url : url     }).done(function (data) {         $(".image-masonry").html(data);          jsintializations()     }).fail(function () {         alert('articles not loaded.');     }); } 

it's working fine, upon clicking button inner page, browser returning page1. here controller function

public function index(request $request) {     $arts = art::with('artist')->orderby('id','asc')->paginate(10);     if($request->ajax()){                     return view('art::art.list', compact('arts');     }     return view('art::art.index', compact('arts'); } 

.image-masonary class in index.blade.php contents of list.blade.php being loaded upon pagination.

this url : http://localhost:8000/admin/arts

i tried method , history.pushstate({ path: url }, '', url);

then button taking ajax route, getting broken view.


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -