I am building a website with CodeIgniter, I have various resources that I load with the base_url helper function like this
This is done simply by doing this variable.
var base_url = ''
This will have base url now. And now make a javascript function that will use this variable
function base_url(string){
return base_url + string;
}
And now this will always use the correct path.
var path = "assets/css/themes/" + color_ + ".css"
$('#style_color').attr("href", base_url(path) );