title: sending data via ajax in Cakephp
body: <p>i am new to cakephp and trying to send data from ajax to my controller action..
   i have a popup model in which there is a input box ..i want to grab that value and send to controller without page refresh</p>
  
  <p>here is my code .. </p>
  
  <pre><code> &lt;a  class="button anthracite-gradient" onclick="openPrompt()"&gt;submit &lt;/a&gt;
  </code></pre>
  
  <p>my javascript</p>
  
  <p></p>
  
  <pre><code> function openPrompt()
  {
  var cancelled = true;
  
  $.modal.prompt('Please enter a value:', function(value)
  {
  
      $.ajax({
          type:"POST",
  
          url:"/cakephp/controller/action/",
          success : function(data) {
             alert(value); //value right now is in this variable ... i want to send this variable value to the controller
  
          },
          error : function() {
             alert("false");
          }
      });
  
  
      }, function()
     {
  
      });
      };
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>myController</strong></p>
  
  <pre><code> public function action(){
      if( $this-&gt;request-&gt;is('ajax') ) {
        $new = $this-&gt;request-&gt;data; 
  
          echo "ok"
          return;
      }
  }
  </code></pre>
  
  <p>i want to first get the value here and then send the response to may ajax request</p>