Welcome Guest, Not a member yet? Register   Sign In
CI constant in JS script
#1

[eluser]obiron2[/eluser]
I'm making increasing use of Ajax and would like to maintain use of full URIs in Ajax calls. What is the best way of setting base_url() and site_url() in JS.

FYI all of my JS is in a separate script file and so is not dynamic.

If I sent a small script as part of the main page header

Code:
print "#script# var BaseURL = ".base_url().";";
print  "var SiteURL = ".site_url()."; #/script#";

would this then be available to the JS file as a global variable, or is there a more elegant solution.

Obiron


Messages In This Thread
CI constant in JS script - by El Forum - 08-28-2007, 05:00 AM
CI constant in JS script - by El Forum - 08-28-2007, 06:38 AM
CI constant in JS script - by El Forum - 08-28-2007, 06:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB