title: cakephp 2.x execute controller in javascript
body: <p>I have the following issue: in cakaphp does not advice anymore the using of jshelper,insted of normal javascript.</p>
  
  <pre><code>    &lt;?php
  $this-&gt;Js-&gt;get('#PostCategoryId')-&gt;event('change', 
  $this-&gt;Js-&gt;request(array(
  'controller'=&gt;'subcategories',
  'action'=&gt;'getByCategory'
  ), array(
  'update'=&gt;'#PostSubcategoryId',
  'async' =&gt; true,
  'method' =&gt; 'post',
  'dataExpression'=&gt;true,
  'data'=&gt; $this-&gt;Js-&gt;serializeForm(array(
  'isForm' =&gt; true,
  'inline' =&gt; true
  ))
  ))
  );
  ?&gt;
  </code></pre>
  
  <p>I don't know how to execute cake controller in js(without using jshelper):</p>
  
  <pre><code>$this-&gt;Js-&gt;request(array(
  'controller'=&gt;'subcategories',
  </code></pre>
  
  <p>Normally in core php, i would do like this:</p>
  
  <pre><code>$("select#category").change(function(){
  var id = $("select#category option:selected").attr('value');
  $.post("select_type.php", {id:id}, function(data){//select_type.php is the "controller"
      $("select#type").html(data);
      });
  });
  </code></pre>
  
  <p>But how to use controller in javascript(jquery)?I am not sure but will it works if i do like this:</p>
  
  <pre><code>$.post("posts/subcategories/getByCategory", {id:id}, function(data){
  </code></pre>