Welcome Guest, Not a member yet? Register   Sign In
passing php variables to external .js files
#4

[eluser]CroNiX[/eluser]
What I do is in the head of my document, which is part of a view file that gets parsed by CI, I define the variables.
Code:
<skript type="text/javascript">
  var base_url = "&lt;?php echo base_url(); ?&gt;";
  //etc
</skript>
Then my external js apps can use base_url because it is already defined in js in the head of the document, before any other scripts are loaded.


Messages In This Thread
passing php variables to external .js files - by El Forum - 09-19-2009, 12:54 PM
passing php variables to external .js files - by El Forum - 09-19-2009, 03:37 PM
passing php variables to external .js files - by El Forum - 04-15-2012, 10:24 PM
passing php variables to external .js files - by El Forum - 04-15-2012, 10:40 PM
passing php variables to external .js files - by El Forum - 04-16-2012, 12:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB