CodeIgniter Forums

Full Version: how to define global variables that are accessible via javascript
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]chubbypama[/eluser]
I have a ci application that includes some ajax calls. After I call ajax methods, i sometimes dynamically build html forms. I would like to be able to "know" the value of base_url() in my javascript. Someone has suggested that I add global js variable declarations to my index.php file that's in the root of my CI application.
How would I do this?

El Forum

[eluser]chubbypama[/eluser]
Resolved.

El Forum

[eluser]TWP Marketing[/eluser]
For posterity and those who search on your title, how did you resolve this?

El Forum