Jquery & CodeIgniter |
[eluser]skyrocket777[/eluser]
Can someone please tell me where to put the file jquery.js (or wich one is the file used?) in order to get the instruction: $this->load->library('jquery'); And be able to used it?
[eluser]Jamie Rumbelow[/eluser]
Well, a CodeIgniter Library is actually a PHP class, so your best bet is to make a helper file with a function in that $this->output->set_output() a <script> tag.
[eluser]skyrocket777[/eluser]
you got me even more confused. Sorry but your explanation is poor and has nothing related with the library wiki's page
[eluser]Jamie Rumbelow[/eluser]
Ok. jquery.js is a JAVASCRIPT file. A codeigniter library is a PHP file.
[eluser]AgentPhoenix[/eluser]
Easiest thing to do now since there isn't a Javascript helper (like there will be in the next version of CI), is to put all your Javascript files at the root in a js folder or something. Then you can call the Javascript files from your views.
[eluser]Lukifer[/eluser]
You can also let Google host jQuery for you. Put the following in your HTML head: Code: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
[eluser]Chris Newton[/eluser]
I know what you're talking about. You're referencing the jquery library on the wiki, here: http://codeigniter.com/wiki/jQuery/ & the library is here: http://www.creatieve-cursussen.nl/jquery.phps The library simply references it like this var $externalJquery='jquery.js'; That will probably not work depending on your controller setup. I'd suggest changing the location in teh library to something like: Code: var $externalJquery='/scripts/jquery.js'; or if you're autoloading the URL helper, you could do this: Code: var $externalJquery=base_url().'scripts/jquery.js'; so that you'd always be targeting relative to your CI application's root (not the web root)
[eluser]Chris Newton[/eluser]
Actually, looks like you can just set it like this: Code: $this->load->library(’jquery’); But there's no harm in changing the default url in the library either. It'll save you a lot of repetitive typing if you're using the library often in your script.
[eluser]Derek Jones[/eluser]
Quote:you got me even more confused. Sorry but your explanation is poor and has nothing related with the library wiki’s page ::glances at the the "Start a discussion about this article!" links in the wiki:: |
Welcome Guest, Not a member yet? Register Sign In |