[eluser]slowgary[/eluser]
I don't think browsers care about the extension. If browsers cared about extensions, they'd get choked up on query strings and such. I think it would be counter-productive for a browser developer to restrict web software to certain extensions, as they would then just have to do more work when a new extension became popular. Think .htm, .html, .shtml, .chm, .cfm, .php, .asp - they all provide the browser with markup. Not to mention, there is NO BENEFIT to restricting file extensions. They basically exist for the developer to differentiate and for operating systems that rely on the file extension to determine the file type.
That being said, I think you can name your function like this:
Code:
function filename_js()
{
}
and still access it via the URL like this:
Code:
http://www.yourdomain.com/controller/filename.js?id=12345
As least on my CodeIgniter install it translates periods to underscores. You'd need to enable query strings in CodeIgniter to be able to do this, obviously. Then you just do your database query and echo valid JavaScript and you should be fine.