base_url () in JS file |
[eluser]Zied[/eluser]
How I can to execute base_url () in js file? I have problem to call images files in lightbox.js, the links are wrong and the photos is not appeared. fileLoadingImage: 'images/lightbox/lightbox/loading.gif', Thinks
[eluser]steelaz[/eluser]
You can set base url for the whole website by adding <base> tag in your header section: Code: <base href="<?= base_url(); ?>"/> So if your application resides in http://www.example.com/app/ and you call for assets (css, images, js) using relative path as in your example: Code: fileLoadingImage: ‘images/lightbox/lightbox/loading.gif’, Browser will actually look for it in http://www.example.com/app/images/lightb...oading.gif You can check the path browser is trying to access by loading Firebug.
[eluser]Zied[/eluser]
is the same problem. when I used Firebug, I found that (<base href="<?= base_url(); ?>"/> exist, but in gray color, and the link is the same.
[eluser]steelaz[/eluser]
When in Firebug, open "Net" tab, then "All" and refresh your page. Assets that can't be fetched will be in red and should give you a clue where the problem is. Also if it's possible, it would help if you could post a link to the page you're working on.
[eluser]Zied[/eluser]
It's the same problem, The project is on local host now, I will upload it and send you the URL page Thinks
[eluser]umefarooq[/eluser]
just define a global base_url in you html page or template before your scripts to call you can in your all js script files Code: in you html page or template file just define once before scripts removed is <script>
[eluser]Caio Russo[/eluser]
hi Zied, Try to use Code: <? = site_url(); ?> instead of base_url(); On my js I use that, and works well.
[eluser]InsiteFX[/eluser]
Try this, replace [removed] tags with you know what. Code: <head> InsiteFX |
Welcome Guest, Not a member yet? Register Sign In |