Welcome Guest, Not a member yet? Register   Sign In
javascript files with php code
#1

Hi guys, I'd like to ask for some generic information, if possible.

I usually try to put all my javascript stuff in a single file, and not keep them inside <skript> tags in my views, so it would be a little bit cleaner and tided up. However there might be some cases where I have ti embed some PHP code inside my javascript, for instance:
PHP Code:
<script type="text/javascript">
$(function() {
    $.
post('<?php echo base_url($url); ?>', function(data){
        
// some code here
    
});
});
</
script

So in this case I'm just leaving these scripts in my views.

I was wondering whether there's a more efficient way to do this, or another better way to organize all javascripts. Would you recommend another way, or in that case, or keep going this way ?
Reply


Messages In This Thread
javascript files with php code - by Lykos22 - 10-02-2015, 09:02 AM
RE: javascript files with php code - by freddy - 10-02-2015, 08:14 PM
RE: javascript files with php code - by JayAdra - 10-02-2015, 08:24 PM
RE: javascript files with php code - by Lykos22 - 10-15-2015, 08:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB