• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
image files from javascript

#1
Greetings, 

I'm continuing some existing projects referencing images via Javascript files e.g.
var images=["<img src='/images/chicken.png'>","<img src='[b]/images/pig.png'>"][/b]
Is it possible to reference these directly from Javascript files located in the assets folder i.e. C:\xampp\htdocs\game\assets\images just for demo purposes, not best practice.
 Cheers
Reply

#2
Always use the base_url() setting:
Code:
<img src="<?= base_url('assets/images/pig.png');?>" />
Reply

#3
hey @wouter60,
thanks for your suggestion. i was also looking for a proper solution for the same. your response was helpful for me.
best regards!!
Reply

#4
cheers wouter
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.