Yii Framework Forum: 强哥,这个怎么解决,关于重复加载jquery的问题 - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

强哥,这个怎么解决,关于重复加载jquery的问题 Rate Topic: -----

#1 User is offline   Billy 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 20-March 12

Posted 15 May 2012 - 11:58 PM

页面1已经加载jq了,然后页面1中弹出一个层(取名页面2),然后页面2中用到了
<?php $form = $this->beginWidget('CActiveForm', array(
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),

));
?>
结果页面2我本来没有加载jq,可是又再一次加载jq了,我看了一下CActiveForm类,$cs->registerCoreScript('yiiactiveform');这个会自动加载jq,请问怎么使页面2里不要再加载jq呢,强哥,这个怎么解决
0

#2 User is offline   qq71151461 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 386
  • Joined: 05-June 09

Posted 17 May 2012 - 02:23 AM

在你第2个页面:
Yii::app()->clientScript->scriptMap = array('jquery.js'=>false, 'jquery.min.js'=>false, 其它不需要的自动加载的js)

0

#3 User is offline   williamjxj 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 17-July 12

Posted 24 July 2012 - 06:10 PM

1. if using Ajax, there is no issue on auto-reload jquery again, just refresh some 'div'.

2. always check source codes to make sure your codes are good performance.

3. I don't know the benefits of using 'widget' and 'CActiveForm' to generate a &lt;form&gt;, why not directly using HTML?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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