Yii Framework Forum: Problem loading JQuery script - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Problem loading JQuery script JQuery script doesn't work Rate Topic: -----

#1 User is offline   lup0z 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 60
  • Joined: 02-May 11

Posted 03 October 2011 - 03:54 AM

Hi,
I can't see JQuery working.
I imported it with
<?php Yii::app()->clientScript->registerCoreScript('jquery'); ?> 

in the main.php layout file (to get JQuery working for all the pages) but nothing works.
I added a

<script type="text/javascript">
	$(document).ready(function(){
						
		alert("screen resolution");
        });
</script>


to see if the problem was in my code, but nor a simple "alert" function works.
How can I work out it?

P.S. I tried to put the "alert" function out from the $(document).ready but nothing happened.
0

#2 User is online   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,353
  • Joined: 12-October 09
  • Location:Croatia

Posted 03 October 2011 - 04:18 AM

If you put alert() out of the document.ready than this is pure javascript - no jQuery... so... is the javascript enabled in your browser?
Find more about me.... btw. Do you know your WAN IP?
0

#3 User is offline   lup0z 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 60
  • Joined: 02-May 11

Posted 03 October 2011 - 04:59 AM

View Postmdomba, on 03 October 2011 - 04:18 AM, said:

is the javascript enabled in your browser?

Of course
1

#4 User is offline   rudenich 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 69
  • Joined: 30-April 10
  • Location:Ukraine-Kramatorsk

Posted 03 October 2011 - 05:01 AM

You must put your code
<script type="text/javascript">
        $(document).ready(function(){
                                                
                alert("screen resolution");
        });
</script>

after <title> tag in your layout or use
registerScript
method
1

#5 User is offline   Duc Tran 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 14-July 11

Posted 08 May 2012 - 01:10 AM

View Postrudenich, on 03 October 2011 - 05:01 AM, said:

You must put your code
<script type="text/javascript">
        $(document).ready(function(){
                                                
                alert("screen resolution");
        });
</script>

after <title> tag in your layout or use
registerScript
method


thanks. it works
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users