This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

JQuery load problem

Forum to discuss ExtJS and other JS plugins

JQuery load problem

by ivelindobrev » Fri Mar 07, 2008 2:32 pm

Hi,

I am trying to implement Jquery library. My goal is to never use prototype and its related built-in libraries.

I installed the jquery plug-in and downloaded the newest version of jquery.

When I load the plug-in, it automatically loads the jquery.js file from ../web/js/jq directory. I also created js file related to a module

The html headers look like this:

Code: Select all
<link rel="shortcut icon" href="/favicon.ico" />
<script type="text/javascript" src="/sf/sf_web_debug/js/main.js"></script>

<script type="text/javascript" src="/js/execcase.js"></script>
[b]<script type="text/javascript" src="/js/jq/jquery.js"></script>[/b]
<link rel="stylesheet" type="text/css" media="screen" href="/sf/sf_web_debug/css/main.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/css/enf.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/css/execcase.css" />
</head>


The execcase.js and .css are module related.

In execcase.js I entered some simple script just to try the jquery:

Code: Select all
$(document).ready(function(){
   $('#execcase').css('border', '1px solid red');
});


the #execcase is the id of a table.

When I load the page the script seems to to workig and when I look into the FireBug console I get the following error message:

Code: Select all
$ is not defined
$(document).ready(function(){


Any ideas to why the jquery library does not load correctly?

I use symfony 1.0.11 and with dev enviroment with the debug toolbar turned on.
ivelindobrev
Junior Member
 
Posts: 29
Joined: Thu Jul 05, 2007 12:35 am
Location: Ukraine

Re: JQuery load problem

by enigma » Sat Jul 26, 2008 3:49 pm

I also have the same problem
I use Firebug plugin for FF, and my additional JS files losk like loaded correctly but my JS code doesn't work.
If I put my JS code into template all works perfect.

It's strange because jQuery loaded by view.ym works correct by my scripts no. Could somebody help me?
Paweł Ryznar - programista JAVA :: Love IT - devBlog
-----------------------------------------------------
@home symfony 1.4 : propel 1.5 : php 5.2.12 : ubuntu 9.04
@work symfony 1.4 : propel 1.5 : php 5.3.2 : ubuntu 10.04
User avatar
enigma
Member
 
Posts: 98
Joined: Wed Mar 21, 2007 9:54 pm
Location: Poland

Re: JQuery load problem

by dante » Sat Jul 26, 2008 5:38 pm

Avoid using $ as that can conflict with prototype. Try the following:

Code: Select all
jQuery.noConflict();
jQuery(document).ready(function() {
...


Use only "jQuery" instead of "$". Does that help?
dante
Senior Member
 
Posts: 158
Joined: Thu Jul 27, 2006 6:36 pm
Location: Germany

Re: JQuery load problem

by enigma » Sat Jul 26, 2008 5:59 pm

I use only jQuery. thanks for tip :)~ :-)~ :smile: now everything work :)~ :-)~ :smile:
Paweł Ryznar - programista JAVA :: Love IT - devBlog
-----------------------------------------------------
@home symfony 1.4 : propel 1.5 : php 5.2.12 : ubuntu 9.04
@work symfony 1.4 : propel 1.5 : php 5.3.2 : ubuntu 10.04
User avatar
enigma
Member
 
Posts: 98
Joined: Wed Mar 21, 2007 9:54 pm
Location: Poland

Re: JQuery load problem

by GaryFx » Sun Jul 27, 2008 4:01 pm

dante wrote: Avoid using $ as that can conflict with prototype.

Why should that matter if he's not loading prototype?
GaryFx
Faithful Member
 
Posts: 377
Joined: Sun May 25, 2008 8:55 am
Location: Masschusetts

Re: JQuery load problem

by dante » Mon Jul 28, 2008 9:16 am

Well, it obviously matters if it's working for him now (at least for the second one :roll: ). You have to take into account that symfony (1.0) loads prototype automatically as soon as you use link_to_remote, for example.
dante
Senior Member
 
Posts: 158
Joined: Thu Jul 27, 2006 6:36 pm
Location: Germany

Re: JQuery load problem

by chainas » Tue Jul 29, 2008 1:34 pm

I got similar problem. In in my local application everything works fine, but when i update my application in shared host. It looks like jquery effects not loaded.

How do i can check, are jquery libs loaded or not ?

Any ideas ?

Thanks for help
chainas
Senior Member
 
Posts: 146
Joined: Thu Mar 13, 2008 12:49 pm
Location: Lithuania

Re: JQuery load problem

by enigma » Tue Jul 29, 2008 1:36 pm

use Firefox and install plugin Firebug
next activate firebug for your site and go to NET tab ant there are all downloaded files - you can browse them
Paweł Ryznar - programista JAVA :: Love IT - devBlog
-----------------------------------------------------
@home symfony 1.4 : propel 1.5 : php 5.2.12 : ubuntu 9.04
@work symfony 1.4 : propel 1.5 : php 5.3.2 : ubuntu 10.04
User avatar
enigma
Member
 
Posts: 98
Joined: Wed Mar 21, 2007 9:54 pm
Location: Poland

Re: JQuery load problem

by chainas » Tue Jul 29, 2008 1:47 pm

I solved the problem, now everything works fine. Perfect help.
Thanks very much to enigma!
chainas
Senior Member
 
Posts: 146
Joined: Thu Mar 13, 2008 12:49 pm
Location: Lithuania

Re: JQuery load problem

by GaryFx » Tue Jul 29, 2008 3:21 pm

dante wrote: Well, it obviously matters if it's working for him now (at least for the second one :roll: ). You have to take into account that symfony (1.0) loads prototype automatically as soon as you use link_to_remote, for example.

True. I forgot about that, since I'm using Dojo and avoiding symfony's Ajax calls entirely.
GaryFx
Faithful Member
 
Posts: 377
Joined: Sun May 25, 2008 8:55 am
Location: Masschusetts

Re: JQuery load problem

by enigma » Sat Aug 02, 2008 9:26 am

yesterday it was problem with:
Code: Select all
jQuery.noConflict();

when I try to load e.x. Thickbox nothig happens, images was open in new window, until I remove this line from my own script. Now all works fine.
Paweł Ryznar - programista JAVA :: Love IT - devBlog
-----------------------------------------------------
@home symfony 1.4 : propel 1.5 : php 5.2.12 : ubuntu 9.04
@work symfony 1.4 : propel 1.5 : php 5.3.2 : ubuntu 10.04
User avatar
enigma
Member
 
Posts: 98
Joined: Wed Mar 21, 2007 9:54 pm
Location: Poland

Re: JQuery load problem

by compubomb » Mon Aug 11, 2008 3:01 pm

Remember to load jquery library first, always, otherwise none of your code will work.

This is a programing langauge, it requires that all important code be loaded first.
compubomb
Junior Member
 
Posts: 1
Joined: Mon Aug 11, 2008 3:00 pm

Re: JQuery load problem

by dasher » Fri Sep 12, 2008 10:38 am

Thickbox (and a few other jQuery plugins) don't work with .noConflict.

The new version (check the top post in the jQuery forums) does - and generally supports all that's in TB - but it's slightly more bleeding edge.
dasher
Junior Member
 
Posts: 1
Joined: Fri Sep 12, 2008 10:29 am