When I alerted the Drupal.settings.basePath
it's just giving me a /
. I have a full $base_url
in settings.php. which I'm expecting to see instead of /
.
How can I get the correct value of the base URL in javascript?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityYou need to pass it manually like this.
global $base_url;
drupal_add_js(array('baseUrl' => $base_url), 'setting');
Then call like this Drupal.settings.baseUrl
.
Drupal.settings.basePath
value is coming from base_path()
api. See this documentation about base_path.