Should probably just use the Drupal.settings.basePath that is provided by the Drupal core.