Welcome Guest, Not a member yet? Register   Sign In
using helpers outside the systems folder
#3

[eluser]Pascal Kriete[/eluser]
I usually have a general javascript view that defines an object literal with a few constants. Just put that in front of all your other scripts.
Code:
</script type="text/javascript">
    <!--
        var CI = {
            'base_url': '<?php echo site_url(); ?>/',
            'blab': '<?php echo $something_my_js_needs; ?>'
        };
    //-->
</script>
Then, to call a url:
Code:
var url = CI.base_url + 'some/url/goes/here';


Messages In This Thread
using helpers outside the systems folder - by El Forum - 08-31-2008, 10:33 AM
using helpers outside the systems folder - by El Forum - 09-01-2008, 07:37 PM
using helpers outside the systems folder - by El Forum - 09-01-2008, 08:13 PM
using helpers outside the systems folder - by El Forum - 09-29-2008, 06:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB