Get base_url using Jquery in Laravel

后端 未结 3 746
孤城傲影
孤城傲影 2020-12-18 05:55

I am using laravel 5.0. I want to get base url of laravel page using jquery. I have tried the following function.

function getBaseURL () {
   return location         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-18 06:16

    You can also use this:

    
    

    You can call it any where in js files like "base_url"

    It return upto your public path without slash at end

    Ex: www.example.com

    If you need to add slash at end you can use this..

    
    

    It return upto your public path with slash at end

    Ex: www.example.com/

提交回复
热议问题