Reputation: 3
I'm using Codeigniter and i would like to know if is possible to use language files (i.e. user_lang.php) in javascript files (i.e. user.js), and if it is possible, how can I do it?.
Upvotes: 0
Views: 177
Reputation: 1733
The answer to your question is a big YES. Like Marc B suggests
<script src="whatever.php"></script>
whatever.php
console.log(<?php echo $someVariable ?>);
//more js/jquery code...
FYI, you can do the same thing for CSS files as well :)
Upvotes: 1