Best place to put jquery file |
[eluser]sooner[/eluser]
What is the best place to put the jquery file?should i create a folder under the system folder or outside of the system folder?how do i include the file in the views i tried to use base_url or site_url..nothing seem to work.i am not sure to generate the url in the src of the script tag.any suggestions plz
[eluser]toopay[/eluser]
i think, CI doesnt care where you put your file, they had url helper. in your view folder, on your files try this : Code: <html> remove space in '< script type', '< /script>' and '$ this ->' Hope that help you.
[eluser]toopay[/eluser]
This section maybe whats you needs : Code: < script type="text/javascript" src="<?php if you are try to include more than one files, you doesnt need to declare/load url helper anymore, in other word you may do that like this : Code: < script type="text/javascript" src="<?php
[eluser]metaltapimenye[/eluser]
Code: [removed][removed]
[eluser]metaltapimenye[/eluser]
Code: < script type="text/javascript" src="<?php echo base_url();?>js/jquery/1.4.2/jquery.min.js">< /script>
[eluser]sooner[/eluser]
i tried both of yours it did not work i actually have my jquery file in system/javascript/jquery-1.4.4.min.js. i did like this [removed]load->helper('url'); echo site_url('javascript/jquery-1.4.4.min.js'); ?>">[removed] if i view source the file [removed][removed] but it does not load up the file i used this [removed]< /script> if i view source [removed]< /script> it does not load the file either suggestions plz
[eluser]Rob @ iFetch[/eluser]
Do you have a htaccess file that would be preventing access to the system directory?
[eluser]Maglok[/eluser]
You shouldn't put scripts inside the system dir. The site_url() function points to controllers, not subdirectories. The proper way is to make a scripts dir under your root and then do: Code: < script type="text/javascript" src="<?php echo base_url();?>scripts/jquery.js">
[eluser]Altaf Hussain[/eluser]
Hi, I ma using my JavaScript file in different ways. If a JavaScript file is common to all, then i place it in data/js folder. Note that data folder is in the root of my CI installation. Then where i need it i just place this code [removed][removed] Just modify that folder names and place it with yours, and it should work.
[eluser]CroNiX[/eluser]
Why host it on your own server at all? Google hosts them for free and then the chances that someone else has been to a site with it and already has it cached is higher. http://ajax.googleapis.com/ajax/libs/jqu...ery.min.js You can also just make the links relative to your site root and not mess with base_url at all. <skript type="text/javascript" src="/assets/js/scriptname.js" /> |
Welcome Guest, Not a member yet? Register Sign In |