Hey everyone,
I have a puzzling problem with trying to make an ajax/static state program. What I am trying to do is allow a static linked app have ajax dynamic urls and everything is kinda fine until a page refresh.
The problem:
PHP Does not see the hash so it only sees the original URI request. So PHP loads the original page but then JQuery (Javascript) replaces that page with the actual one I want after the #. Example:
url: localhost/index.php#!/search
It is fine to navigate to this page but pressing refresh php goes for:
url: localhost/index.php
and then javascript goes for:
url: #!/search
So I actually load two pages...which sucks.
This is a problem that must have occured and I notice facebook have done it to help load times (same reason I wanna do it). From the best I can tell they are able to reliably detect the hash and replace $_SERVER['REQUEST_URI'] with its contents so when you refresh you get localhost/search from localhost/index.php#!/search.
I was wondering if anyone has a little fix for this. I have looked in server side javascript but after a lot of googling I didn't really get a clear picture.
Thanks in advance