smoreno91
smoreno91

Reputation: 3

is possible to use *_lang.php files in javascript files?

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

Answers (1)

Eisa Adil
Eisa Adil

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

Related Questions