0

I just bought a single page template ( smartadmin ) which loads contents using ajax and change url using a pattern "/#ajax/file.html".

I was surprised that I can navigate through it without setting routes, and even if I set a route it doesn't work. Example :

Route::get('/#ajax/inbox.php', function() { return View::make('test'); });

How should I do the routing?

tereško
  • 58,060
  • 25
  • 98
  • 150
Ploxer
  • 88
  • 1
  • 11
  • the problem is, everything after the `#` will not be processed by the backend, only handled in the front-end itself. – Simon Wicki Jun 24 '14 at 11:58
  • Are you saying that there is no way to manage routes in a single page application that loads pages through ajax? That's weird, because I can call php scripts after the `#`. – Ploxer Jun 24 '14 at 13:08
  • that's what ajax is doing. the portion after `#` just executes a request, which does not contain any hashtags at all. in your smartadmin example, it simply gets an html page and replaces it. – Simon Wicki Jun 24 '14 at 13:17

2 Answers2

0

as mentioned in my comment, you can't grab the portion of the url after the #.

more infos: Can I read the hash portion of the URL on my server-side application (PHP, Ruby, Python, etc.)?

Community
  • 1
  • 1
Simon Wicki
  • 4,029
  • 4
  • 22
  • 25
0

In the ng.app.js file there is a line that will look like this

smartApp.config(['$routeProvider', '$provide', function($routeProvider, $provide) {

in that code you'll see something like return 'views/'+ $routeParams.page +'.html'; thats where the angular js version of smart admin makes the request. maybe this will help you.

sorry if you are not using the angular version of smart admin. I just bought it my self and I am struggling to laravel it up..

Zach Robichaud
  • 183
  • 1
  • 7