Welcome Guest, Not a member yet? Register   Sign In
How to use base_url() in js file
#4

[eluser]davidbehler[/eluser]
You can't use php code inside js files.

What dnyce meant is this:
Place this code in the header of your page
Code:
<scr1pt type="text/javascr1pt">
&lt;?php echo "var base_url = ". base_url(); ?&gt;
</scr1pt>
and then use it like this
Code:
$.post(base_url + '/admin/dashboard/getStuff', {var: qt, ajax:'1'},...


Messages In This Thread
How to use base_url() in js file - by El Forum - 01-27-2010, 03:40 PM
How to use base_url() in js file - by El Forum - 01-27-2010, 03:59 PM
How to use base_url() in js file - by El Forum - 01-27-2010, 04:12 PM
How to use base_url() in js file - by El Forum - 01-27-2010, 04:15 PM
How to use base_url() in js file - by El Forum - 01-27-2010, 04:39 PM
How to use base_url() in js file - by El Forum - 01-27-2010, 04:46 PM
How to use base_url() in js file - by El Forum - 01-27-2010, 05:11 PM
How to use base_url() in js file - by El Forum - 01-27-2010, 05:15 PM
How to use base_url() in js file - by El Forum - 01-30-2010, 02:18 AM
How to use base_url() in js file - by El Forum - 02-02-2012, 06:44 AM
How to use base_url() in js file - by El Forum - 02-02-2012, 07:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB