title: Including JS file in View In YII
body: <p>I want to load the <code>JS</code>  file in view to avoid heavy-loading of my application. I am using this <code>JS</code> file for <code>CgrdView</code> in view. SO i tried this:</p>
  
  <pre><code>Yii::app()-&gt;clientScript-&gt;registerScriptFile(
  Yii::app()-&gt;baseUrl.'/assets/9d419b82/jquery.ba-bbq.js?v=1.0.127'
  );
  </code></pre>
  
  <p>in My view header.
  But i am getting the error:<strong>Uncaught ReferenceError: jQuery is not defined</strong>
  As stated, i want to load jquery.ba-bbq.js file in view for CgriView, but i am not able to load that.
  Instead, i use following, but dont know is the efficient way to load or not.</p>
  
  <pre><code>&lt;script src="/assets/9d419b82/jquery.ba-bbq.js?v=1.0.127" type="text/javascript"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>And is working when i load that in layouts, but this is not the efficient way.</p>
  
  <p>FYI: I am working with <code>cgridview</code> search-box to post the search-box entry to my controller.</p>