CodeIgniter Forums
Problem with using jquery - 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: Problem with using jquery (/thread-54003.html)

Pages: 1 2 3


Problem with using jquery - El Forum - 08-17-2012

[eluser]kingmaoam[/eluser]
Hi,

I have a problem with jquery. I am using the datepicker.

When I initialize jquery with
Code:
<.script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></.script>
<.script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></.script>
everything works fine.

But when I switch to my local jquery Files
Code:
<.script type="text/javascript" src="&lt;?=base_url('js/jquery/jquery-1.8.0.min.js')?&gt;"></.script>
<.script type="text/javascript" src="&lt;?=base_url('js/jquery/jquery-ui-1.8.23.custom.min.js')?&gt;"></.script>
I am getting the javascript error
Code:
ReferenceError: $ is not defined [http://feuerwehr.sarbas.net/admin/content/createEinsatz/NDUyZWU1NjczMWR:241]

Has anyone had this problem before?
I have addes the dots at the front of the script tags for not to have them switched to [removed] in this post.

KR
Habib


Problem with using jquery - El Forum - 08-17-2012

[eluser]Oscar Dias[/eluser]
Check the source code of the rendered view. If the SCRIPT tag has the correct SRC, then the problem is in the js's files. Otherwise could be a problem in your base_url definition in the config file.


Problem with using jquery - El Forum - 08-18-2012

[eluser]kingmaoam[/eluser]
Hi

Base_url should be fine. Works with my CSS Files and my urls.
The jquery file was downloaded from jqueryui.com and not customized.


Problem with using jquery - El Forum - 08-18-2012

[eluser]Samus[/eluser]
Do it like this bro.

Code:
<.script type="text/javascript" src="&lt;?=base_url();?&gt;js/jquery/jquery-1.8.0.min.js"></.script>
<.script type="text/javascript" src="&lt;?=base_url();?&gt;js/jquery/jquery-ui-1.8.23.custom.min.js"></.script>



Problem with using jquery - El Forum - 08-19-2012

[eluser]kingmaoam[/eluser]
Hi,

generated head tag is
Code:
&lt;link rel="stylesheet" href="http://feuerwehr.sarbas.net/css/admin/layout.css" type="text/css"&gt;
&lt;link rel="stylesheet" href="http://feuerwehr.sarbas.net/css/admin/buttons.css" type="text/css"&gt;
&lt;link rel="stylesheet" href="http://feuerwehr.sarbas.net/css/admin/pagination.css" type="text/css"&gt;
&lt;link rel="stylesheet" href="http://feuerwehr.sarbas.net/css/admin/jquery-ui-1.8.23.custom.css" type="text/css"&gt;
<.script type="text/javascript" src="http://feuerwehr.sarbas.net/js/jquery/jquery-1.8.0.min.js"></.script>
<.script type="text/javascript" src="http://feuerwehr.sarbas.net/js/jquery/jquery-ui-1.8.23.custom.min.js"></.script>

Doesn't matter if I use base_url('url'); or base_url();url, it is always the same result in rendered page and datepicker not working.

Any other ideas?

KR
Habib


Problem with using jquery - El Forum - 08-19-2012

[eluser]kingmaoam[/eluser]
I used firebug to debug my code and it says

Code:
"NetworkError: 500 Internal Server Error - http://feuerwehr.sarbas.net/js/jquery/jquery-1.8.0.min.js"
"NetworkError: 500 Internal Server Error - http://feuerwehr.sarbas.net/js/jquery/jquery-ui-1.8.23.custom.min.js"

I have checked the chmod for js dir, subdirs and files and it is 777

On manually opening the url http://feuerwehr.sarbas.net/js/jquery/jquery-1.8.0.min.js the js file is displayed.

any idea?


Problem with using jquery - El Forum - 08-19-2012

[eluser]Samus[/eluser]
[quote author="kingmaoam" date="1345372651"]I used firebug to debug my code and it says

Code:
"NetworkError: 500 Internal Server Error - http://feuerwehr.sarbas.net/js/jquery/jquery-1.8.0.min.js"
"NetworkError: 500 Internal Server Error - http://feuerwehr.sarbas.net/js/jquery/jquery-ui-1.8.23.custom.min.js"

I have checked the chmod for js dir, subdirs and files and it is 777

On manually opening the url http://feuerwehr.sarbas.net/js/jquery/jquery-1.8.0.min.js the js file is displayed.

any idea?[/quote]
It isn't displayed for me. It says you need to set a default controller in your routes.

Have you done that?

I don't think so, because I tried to access the route of that site and it gave the same error.

Anyway the best way to use jquery would be to use google's CDN anyway.


Problem with using jquery - El Forum - 08-19-2012

[eluser]DarkManX[/eluser]
Try to set $config['csrf_protection'] to FALSE

PS: can you show ur root .htaccess pls?


Problem with using jquery - El Forum - 08-19-2012

[eluser]kingmaoam[/eluser]
Hi

Direct Access to this URL works only when I rename htaccess because of mod_rewrite enabled.
Using the hosted files works for jquery but I have another Problem with TinyMCE which also doesn't work with the local files.

I will Post the htaccess when i am back at my Computer.


Problem with using jquery - El Forum - 08-19-2012

[eluser]kingmaoam[/eluser]
ok..... thanks for the hint with the htaccess file...
There I found the problem which concerned me for about 1 week...

changing
RewriteCond $1 !^(index\.php|css|images|robots\.txt)
to
RewriteCond $1 !^(index\.php|css|js|images|robots\.txt)

helps alot :-)

Now my TinyMCE is working to!
Yihaaa !!! :-)

KR
Habib