Base_url in js file

how can we print base_url in js file (in drupal)?

+4
source share
2 answers

Drupal 7

Drupal.settings.basePath 

Drupal 8

 drupalSettings.path.baseUrl 
+22
source

You can use $base_path . See the Drupal JavaScript API Example in the Drupal.settings section.

+2
source

Source: https://habr.com/ru/post/1341345/


All Articles