How to get base url with jquery or javascript?

后端 未结 24 1382
忘掉有多难
忘掉有多难 2020-12-12 13:59

In joomla php there I can use $this->baseurl to get the base path, but I wanted to get the base path in jquery.

The base path may be any of the follo

24条回答
  •  情歌与酒
    2020-12-12 14:52

    You mentioned that the example.com may change so I suspect that actually you need the base url just to be able to use relative path notation for your scripts. In this particular case there is no need to use scripting - instead add the base tag to your header:

    
      
    
    

    I usually generate the link via PHP.

提交回复
热议问题