CodeIgniter Forums
Images files from javascript - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Images files from javascript (/showthread.php?tid=77508)



Images files from javascript - Resolution - 09-09-2020

Greetings,

I'm continuing some existing projects referencing images via Javascript files e.g.
var images=["<img src='/images/chicken.png'>","<img src='/images/pig.png'>"]
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


RE: Images files from javascript - Omar Crespo - 09-09-2020

Did you tried to use an absolute route for your demo purposes?? You should.


RE: Images files from javascript - InsiteFX - 09-10-2020

Use jQuery to Asynchronously Load an Image


RE: Images files from javascript - Omar Crespo - 09-10-2020

var images = ["<img src='http://localhost/CodeIgniter/assets/images/chicken.jpg'>", "<img src ='http://localhost/CodeIgniter/assets/images/pig.png'>"];