title: How to call a javascript function in controller of codeigniter?
body: <p>i have a view like this</p>
  
  <pre><code>&lt;p&gt;
     &lt;div id="error_msg" class="alert alert-error"&gt; //at this div have css .alert{display:none;}
        &lt;a class="close click_close"&gt;X&lt;/a&gt;
        &lt;strong&gt;oops!&lt;/strong&gt; username atau password yang anda masukan salah
     &lt;/div&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>and in my controller</p>
  
  <pre><code>public function login_form() {
      $this-&gt;form_validation-&gt;set_rules('username', 'Username', 'required|trim|xss_clean');
      $this-&gt;form_validation-&gt;set_rules('password', 'Password', 'required|md5|xss_clean');
      $this-&gt;form_validation-&gt;set_error_delimiters('&lt;span class="error"&gt;', '&lt;/span&gt;');
  
      if($this-&gt;form_validation-&gt;run()==FALSE) {
          $this-&gt;load-&gt;view('v_admin_login');
      } else {
          $username = $this-&gt;input-&gt;post('username');
          $password = $this-&gt;input-&gt;post('password');
  
          $cek = $this-&gt;m_admin_login-&gt;getAdmin($username, $password, 1, 1);
  
          if($cek &lt;&gt; 0) {
              $this-&gt;session-&gt;set_userdata('isLogin', TRUE);
              $this-&gt;session-&gt;set_userdata('username',$username);
              $this-&gt;session-&gt;set_userdata('level',$level);
  
              redirect('admin');
          } else {
              //I want to change class alert to .alert{display:block}
              //What should I do?
          }
      }
  }
  </code></pre>
  
  <p>the point is i want to show div with class alert if input username or password was wrong..</p>