Getting the base drupal dir in JavaScript I am writing a module that does ajax calls through the uses of javascript (not the Drupal ajax engine) to its Drupal installation, which in my case is {host}/drupal7.

My Ajax call should call "{host}/drupal7/notifications/get" from any page. Yet when I do my ajax call from javascript it calls "{host}/notifications/get" now this seems like an easy fix. Yet I can't think of a way to compose the right URL in a way that it will work in any installation.

Can anyone point me in the right direction?
You should use Drupal.settings.basePath in your Javascript.