php - Pjax and Laravel routes -


currently integrating jquery pjax, best explain. have working inside first view when accessing url address directly address bar view without @extends('layout.main').

here setup:

routes, 1 route retailers.index view , other parameter , retailers.stores view.

route::get('retailers', array(     'as' => 'retailers',      'uses' => 'sitecontroller@retailers'));  route::get('retailers/{city}', array(     'as' => 'find-retailers',     'uses' => 'sitecontroller@getretailers')); 

controllers:

public function retailers() {  $listings = db::table('retailers_listings') ->orderby('counter', 'desc') ->groupby('country') ->get();  return view::make('retailers.index') ->with('retailers_listings', $listings) }  public function getretailers($city) {      $locations = db::table('retailers_listings') ->orderby('country', 'asc') ->where('city', $city) ->get();  return view::make('retailers.stores') ->with('retailers_listings', $locations); } 

href pjax , url route retailers.stores view - using find-retailers

<a data-pjax href="{{ url::route('find-retailers', array('city' => $string)) }}"> {{ $string }} </a> 

inline js

$(document).pjax('[data-pjax] a, a[data-pjax]', '#pjax-container') 

if loading /retailers (index) works , if press link load store.retailers view inside <div id="pjax-container"></div> , url change retailers/{country}. if load url address bar directly load view without @extends('layout.main'), not call in retailers.stores view because load retailers.stores in pjax.

basically works, not when loading directly address bar.

laravel has no idea you're using pjax.

you should include @extends('layout.main') in each route. in order work pjax, should make layout.main spit out site layout if request::ajax() false.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -