Yii Framework Forum: Don't ajax a script tag - Yii Framework Forum

Jump to content

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

Don't ajax a script tag Rate Topic: -----

#1 User is offline   notzippy 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 201
  • Joined: 06-October 08

Posted 07 May 2009 - 10:50 PM

Do not place <script> tags in any type of view, because script tags get corrupted when used to replace an elements' innerHtml. Instead always use the code to "Yii::app()-> clientScript-> registerScript" to register scrips outside of a view.
Then this will always work

      $data = $this->renderPartial("theView", array("theInfo"=>$theInfo),true);
      $script .= "jQuery("#contentList").html("".
      CJavaScript::quote($data)     
      ."");";
      Yii::app()-> clientScript->     
            registerScript("theScript", "$script;", CClientScript::POS_HEAD);


nz
2

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