0

How do I pull information from an ajax url? So if my url is http://mysite.com/#!/profile/1/, how would I pull that 1? Currently I am using $get[''] but that pulls stuff after a ? not after a #. Thanks!

Joe Torraca
  • 1,849
  • 5
  • 29
  • 49
  • As far as I know there's no way to get the data after the # in PHP - if you want it in PHP, you'll have to have your Javascript send it to PHP as a subsequent AJAX request. – JoLoCo Mar 05 '12 at 01:54
  • 3
    Given that URL, look at `$_SERVER['REQUEST_URI']`. You can break it down into pieces and extract the various tokens in the URL. – drew010 Mar 05 '12 at 01:55
  • 1
    Are u using jquery for ajax communication ? if yes then you can pass build a datastring and get the values $_GET or $_POST irrespective of the type. – thomasbabuj Mar 05 '12 at 01:56
  • Ok thanks, I didn't think of making an ajax request. – Joe Torraca Mar 05 '12 at 01:58
  • 2
    See here for more: http://stackoverflow.com/questions/967649 (duplicate question?) – JoLoCo Mar 05 '12 at 01:58
  • @JoLoCo: yep, I would say that's similar to. And I would suggest to @Joseph Torraca to look at the second answer under that question, because that's how you do it: get the hash bit with javascript, and then pass it into the ajax object/url behind a `?` so the php can handle it. – kasimir Mar 05 '12 at 08:56

0 Answers0