amic há 8 meses atrás
pai
commit
c6f589e5e0
2 ficheiros alterados com 20 adições e 19 exclusões
  1. 19 1
      views/layouts/main.php
  2. 1 18
      views/site/index/inquirer_wide.php

+ 19 - 1
views/layouts/main.php

@@ -181,7 +181,25 @@ AppAsset::register($this);
 
     })()
 </script>
-
+<?
+$filterurl = \yii\helpers\Url::base('https')."/inquirer/ajax";
+$this->registerJs(
+<<<JS
+    function sendask(idq){
+		ask = $('input:checked[name=ask_'+idq+']').val()
+		$.post( "$filterurl", { 'idq': idq, 'ask': ask }, function( data ) {
+			if( data.status == 'ok' ){
+				//document.location.reload();
+				console.log(data.status);
+				$(".answer[key='"+idq+"']").html(window.bghtml[idq]);
+			}
+		});
+    }
+JS
+    ,
+    yii\web\View::POS_END, 'send-ask'
+);
+?>
 <?php $this->endBody() ?>
 </body>
 </html>

+ 1 - 18
views/site/index/inquirer_wide.php

@@ -13,7 +13,7 @@ use yii\web\View;
 $id = $design->parent_id;
 $query = Inquirer::find()->where([ 'active'=>'Y', 'id'=>$id])->limit(1)->One();
 $model = $query;
-echo "<!-- 1 опроса широкий -->";
+echo "<!-- 1 опроса широкий -->\n";
 if(!is_null($design->parent)){
     echo Html::tag('h2',Html::a($design->parent->title,[$design->parent->getUrl()]),['class'=>"widget-title mt-2 text-center"]);
 }
@@ -58,23 +58,6 @@ if( $model->show == 'N'  ){
 	window.bghtml[<?=$model->id?>] = '<?=$bghtml?>';
 </script>
 <?
-$filterurl = \yii\helpers\Url::base('https')."/inquirer/ajax";
-$this->registerJs(
-<<<JS
-    function sendask(idq){
-		ask = $('input:checked[name=ask_'+idq+']').val()
-		$.post( "$filterurl", { 'idq': idq, 'ask': ask }, function( data ) {
-			if( data.status == 'ok' ){
-				//document.location.reload();
-				console.log(data.status);
-				$(".answer[key='"+idq+"']").html(window.bghtml[idq]);
-			}
-		});
-    }
-JS
-    ,
-    View::POS_END, 'sendask'
-);
 }
 ?>
 			</div>