Welcome Guest, Not a member yet? Register   Sign In
How create a JavaScript file with a view in CodeIgniter?
#13

[eluser]slowgary[/eluser]
It sounds like an okay way to me. It looks like ivarsmas intends on allowing third party applications to include a javascript file from his site, but in it he needs to include some code that is specific to that site or user. It could also be done using a second script tag, like so:
Code:
< script type='text/javascript' >
var ivarsmas_id = '12345';
< /script >
&lt; script type='text/javascript' src='http://www.ivarsmas.com/filename.js' &gt;&lt; /script >
Then your script could check the value of that variable and do what it needs to do. The problem with this method though is that not only is it more complicated for the third party, but you'd need to check the variable then do your dynamic processing with AJAX, which is all just more overhead. I prefer the single include"
Code:
&lt; script type='text/javascript' src='http://www.ivarsmas.com/filename.js?id=12345' &gt;&lt; /script >
Easy and clean.


Messages In This Thread
How create a JavaScript file with a view in CodeIgniter? - by El Forum - 07-20-2009, 03:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB