CodeIgniter Forums
Error, Loading Jquery Class - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Error, Loading Jquery Class (/thread-49589.html)



Error, Loading Jquery Class - El Forum - 02-26-2012

[eluser]Agitaous11[/eluser]
Jquery Won't Load as Explained In CI Documentation

Hello, I am trying to use some jquery feature in my CI, Php Project. I opened the documentation and started to read.

Under The jQuery Class section, it is written that, we can write $this->load->library('jquery'); to use jquery. The problem is that, when I write this, my page gives me

Quote:An Error Was Encountered

Unable to load the requested class: jquery

So;
I decided to give the jquery link in my view file instead, and remove the library code. If I write the function myself and use it; there is no problem. But removing the load library code, and using $this->load->library('javascript'); gives me a The White Screen Of Death which we are familiar from drupal. Absolutely no output.

And removing it too. (I already wrote <script type="text/javascript" src="<?php echo $library_src;?>"></script> instead).
and just using
$this->jquery->slideToggle('upperheader');
And The Result
Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: Main_Controller::$jquery

Filename: controllers/main_controller.php

Line Number: 7

I understand the last error, I didn't load the jquery library. Yes. But I couldn't.

What am I missing?

Help Please.


Error, Loading Jquery Class - El Forum - 02-27-2012

[eluser]Aken[/eluser]
In my opinion, you shouldn't be using the library in the first place. Javascript should be separated from the back-end logic, and handled on its own elsewhere in your application structure.