0

So we have a URL. This url looks like: www.test.com/#test

How do I grab the #test using something similar to

statereq = request.querystring("state")

I need to perform an action based on what # is.

webaware
  • 2,795
  • 2
  • 30
  • 37
sephiith
  • 1,187
  • 3
  • 23
  • 47

1 Answers1

4

You can't. It isn't sent to the server.

John Conde
  • 217,595
  • 99
  • 455
  • 496
  • Is there any alternative? As we can not use traditional query strings, ?state=test. etc. – sephiith Jan 21 '13 at 23:47
  • 1
    You *can* grab it via JavaScript so if you can use that you can then get the hash and send it to your server via Ajax. – John Conde Jan 21 '13 at 23:49
  • I wouldn't have a clue how to do that. Could you assist? Or do I need to create a new question? – sephiith Jan 21 '13 at 23:49
  • See [here](http://stackoverflow.com/questions/298503/how-can-you-check-for-a-hash-in-a-url-using-javascript) for how to get the hash. There are lots of tutorials for how to use ajax in google and probably on stackoverflow. – John Conde Jan 21 '13 at 23:52
  • I have managed to get the hash and assigned it to a variable. How do I use that value to alter the sql? – sephiith Jan 22 '13 at 00:16
  • @sep with jQuery use .get("page.asp?hash=" + myJS_var); then just read the querystring parameter in ASP and use in your SQL. – Shadow The GPT Wizard Jan 22 '13 at 09:10