title: print alert box in response to a ajax call in yii2
body: <p>I have this jquery code in my view file</p>
  
  <pre><code>$('#ticket-ticket_impact_id').change(function() {
  
    var priority = $('#ticket-ticket_priority_id :selected').val();
    var impact = $('#ticket-ticket_impact_id :selected').val();
    if ($('#ticket-ticket_priority_id').val() == '' || $('#ticket-ticket_impact_id').val() == '') {
  
    } else {
      $.post('index.php?r=support/ticket/ajax-ticket-sla&amp;ticket_priority_id=' + priority + '&amp;ticket_impact_id=' + impact);
    }
  })
  
  $('#ticket-ticket_priority_id').change(function() {
  
    var priority = $('#ticket-ticket_priority_id :selected').val();
    var impact = $('#ticket-ticket_impact_id :selected').val();
    if ($('#ticket-ticket_priority_id').val() == '' || $('#ticket-ticket_impact_id').val() == '') {
  
    } else {
      $.post('index.php?r=support/ticket/ajax-ticket-sla&amp;ticket_priority_id=' + priority + '&amp;ticket_impact_id=' + impact);
    }
  })
  </code></pre>
  
  <p>from here the value the of priority and impact id is sent to the controller/ajax function</p>
  
  <pre><code>public function actionAjaxTicketSla(){
      $ticket_priority_id=$_REQUEST['ticket_priority_id'];
      //var_dump($ticket_priority_id);die();
      $ticket_impact_id=$_REQUEST['ticket_impact_id'];
      if(Sla::find()-&gt;where(['ticket_priority_id'=&gt;$ticket_priority_id,'ticket_impact_id'=&gt;$ticket_impact_id])-&gt;exists())
      { 
  
      } else{
          echo '&lt;script type="text/javascript"&gt;alert("No sla defined!");&lt;/script&gt;';
      }
  }
  </code></pre>
  
  <p>I am not able to even echo something in response here don't know whats wrong here any help would be appreciated.</p>
  
  <p>response
  <a href="https://i.stack.imgur.com/bfBkC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bfBkC.png" alt="enter image description here"></a></p>