Jul 30 2007
∞
ME SO AJAXY: Getting the current path/URL in drupal.
$current_path= drupal_get_normal_path($_GET['q']);That wasn’t terrible, was it? If you’re using an alias, this won’t necessarily get you a ‘matching’ pathname, but for an AJAX query that calls a URL the user probably isn’t gonna see anyways, it looks like it’ll work nicely. * If you’re wondering why I think I need this: I’m making some AJAX calls to a ‘path’ that includes the user id, and I don’t really want to be passing a $uid field through two levels of ‘theme’ functions just to build a link. *unless they have firebug, and at that point, they probably already knew you were a halfwit by flipping through your dumb JS comments.