我使用laravel
默认分页并使用以下代码将数据发送到视图页面,
$main_category = pep_bank_maincategory1::select('main_cat_id','main_cat_name')->where('status',0)->paginate(10);
return view('sompage')->with('main_category',$main_category);
在我的刀片中,我使用代码显示它。
{!! $main_category->render() !!}
我正在成功显示它,但是当我点击下一个按钮时页面会刷新如何避免它。下面是我在视图页面中渲染的对象。
{"total":43,"per_page":10,"current_page":1,"last_page":5,
"next_page_url":"http:\/\/localhost:8000\/launch\/?page=2","prev_page_url":null,"from":1,
"to":10,"data":[{"main_cat_id":1,"main_cat_name":"Agriculture"},
{"main_cat_id":2,"main_cat_name":"Apparel"},
{"main_cat_id":3,"main_cat_name":"Automobiles & Motorcycles"},
{"main_cat_id":4,"main_cat_name":"Business Services"},
{"main_cat_id":5,"main_cat_name":"Chemicals"},
{"main_cat_id":6,"main_cat_name":"Computer Hardware & Software"},
{"main_cat_id":7,"main_cat_name":"Construction & Real Estate"},
{"main_cat_id":8,"main_cat_name":"Consumer Electronics"},
{"main_cat_id":9,"main_cat_name":"Electrical Equipments"},
{"main_cat_id":10,"main_cat_name":"Electronic Components"}]}
答案 0 :(得分:0)
你可以在code.hope下面试试这个。
{!! $main_category->appends(Input::except('page'))->render() !!}