0

I m in a situation where i am redirecting user to another page with following jQuery code

window.location = "/#/customer/email?isEmail=true&eid=1&template=2";

i have some url re-writing , and so complete url becomes is

https://demo.qa.com/#/customer/email?isEmail=true&eid=1&template=2

but in PHP when i try to get full page url using this

echo $_SERVER['REQUEST_URI'];

it just gives me this

/

i just want to get variable IsEmail

$_GET['IsEmail']

value in PHP page,

I think the

#

in between the URL is creating the problem, is there any way to get it, please advise..

2
  • maybe try using substr us3.php.net/substr Commented Nov 22, 2013 at 4:21
  • @cook that won't work if PHP doesn't have a value to use for substr.
    – Class
    Commented Nov 22, 2013 at 4:27

2 Answers 2

5

The fragment is never sent to the server, so if you want access to the query parameters you need to bring them forward:

https://demo.qa.com/?isEmail=true&eid=1&template=2#/customer/email
                    ^                             ^
                    query                         fragment
0
1

The anchor fragment portion of the URL (anything after #) isn't sent to the server at all. It only lives client-side. The server has no knowledge of it, and therefore PHP has no knowledge of it.

If you want to do anything with the anchor fragment, you must do it client-side.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.