title: How to call a Javascript function using Cakephp
body: <p>I have a function in my view(aval_comp.ctp). 
  When I do a calculation in is function on the controller, I want to call my Javascript function. </p>
  
  <p>Js Function:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function calculateTotal(){
           var total = document.getElementById('valor1').innerHTML*1 + document.getElementById('valor2').innerHTML*1 + document.getElementById('valor3').innerHTML*1 + document.getElementById('valor4').innerHTML*1 + document.getElementById('valor5').innerHTML*1 + document.getElementById('valor6').innerHTML*1;
           document.getElementById('total').innerHTML = total;
       }
   &lt;/script&gt;
  </code></pre>
  
  <p>How do I call that function in the Controller?</p>