0

Any one know how to echo raw javascript from controller. I need to use a window open on specific case after a ajax request, As for specific ajax cases url can have different parameters. And I managed it in one private method on Controller Side. So all ajax requests method call this private method and in case of condition met, Open a window through it. I tried like

echo "<script language='javascript'>window.open('$url', '_parent', '')</script>";  

But look like Yii filtered html for safety.

4

1 回答 1

0

我想你正在寻找这个功能: http ://www.yiiframework.com/doc/api/1.1/CClientScript#registerScript-detail

Yii::app()->clientScript->registerScript('myscript', "window.open(" . $url . ", '_parent', '')");
于 2013-07-11T07:21:04.613 回答