Is there any way to access codeigniter language and config properties from included javascript files
- by ubermensch
Good morning!
I'm having great success so far with CodeIgniter. I'm new to PHP and web development in general, but I feel that CodeIgniter is giving me a leg up while I catch up on the basics.
My question for today is this - I have been happily loading config and lang values from my views for a while now, and everything is working fine. But what about JavaScript files being linked into my views? Is there any way to make the $this-lang-line and $this-config-item function references available to me in my JavaScript files?
I am implementing jQuery client-side validation, and would like to pull in my error messages from the server, both to support internationalisation and to make sure that validation gracefully degrades if JavaScript is not available, in that the error messages pushed back into the view from the server-side validation are identical to those displayed dynamically by the jQuery validation. I would not like to have to keep coming back to make sure that these strings are kept in sync. As for internationalisation, I'm fresh out of ideas on how to support that if it turns out that lang and config item strings are completely unavailable from my JS files.
Any help you can provide would be greatly appreciated! :)