Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get #part in URL with PHP/Symfony

I'm working with Symfony 1.2. I've a view with a list of objects. I can order them, filter them by category, or moving to the next page (there is pagination). Everything is done with AJAX, so I don't have to load all the page again.

What I want to achieve is to have http://urltopage#page=1&order=title&cats=1,2 for example; so the new page is saved in the browser history, and he can paste it to another web.

I haven't found a way to get the #part. I know that's only for the browser but I can't believe I can't get through PHP. I'm sure there is a simple solution I'm missing...

thanks a lot!

like image 945
fesja Avatar asked Apr 12 '10 17:04

fesja


1 Answers

You can't get it through PHP because it's never transmitted to the server.

You can, however, get it with JavaScript via window.location.hash, then transmit it to the server via AJAX.

like image 134
Powerlord Avatar answered Sep 19 '22 13:09

Powerlord