title: best practice to use action url while calling ajax in cakePHP
body: <p>I am using ajax with jQuery in my cakePHP application.<br>
  and my javascript function is placed inside a javascript file.  </p>
  
  <p>now in my local system the files are kept in "/sample" directory so the the path while i call the function will be </p>
  
  <p>in ajax.js  </p>
  
  <pre><code>$.post({url : "/sample/controller/action"})
  </code></pre>
  
  <p>but after hosting it the url will become</p>
  
  <pre><code>$.post({url : "/mydomain.com/controller/action"})
  </code></pre>
  
  <p>in cakePHP we <code>$html-&gt;url</code> to generate urls<br>
  but since this code is in js file i can't use that function</p>
  
  <p><strong>i don't want to change the all ajax action urls manually before hosting</strong></p>