title: Calling a PHP function with parameters form URL via Ajax
body: <p>Please have a look at the following code</p>
  
  <p>....The Javascript code in ctp file...</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function(){
  
  
     $( ".btn-danger" ).click(function(){
          console.log("Red Button");
          var toclose = $(this).parent().parent();
          $.ajax({
            url: "../img/media.jpg",
          }).done(function() {
              console.log( "The act has been done");
              toclose.toggle();
            });
     }); 
  
  
     $( ".btn-success" ).click(function(){
        console.log("Red Button");
        idOfButton = $(this).attr('id');
        var toclose = $(this).parent().parent();
        $.ajax({
          url: "../img/media.jpg",
        }).done(function() {
            increment(idOfButton);
              alert(idOfButton);
        console.log( "The act has been done");
            toclose.toggle();
        });
   }); 
  
    $( ".xy" ).click(function(){
  
      $(this).find("#enside1").toggle();
      $(this).find("#ptside1").toggle();
      console.log(this);
    });
  
        function xxx(id)
    {
        alert(id);
    }
  
    function increment(uniqueWord)
    {
        $.ajax({
            url: "http://localhost/cake2/flip2/correct",
                    data: {word: uniqueWord}
  
          }).done(function() {
              console.log( "The act has been done");
              toclose.toggle();
            });
  
      }
  
  });
  
  
  &lt;/script&gt;
  </code></pre>
  
  <p>Please consider this function</p>
  
  <pre><code>function increment(uniqueWord)
    {
        $.ajax({
            url: "http://localhost/cake2/flip2/correct",
                    data: {word: uniqueWord}
  
          }).done(function() {
              console.log( "The act has been done");
              toclose.toggle();
            });
  
      }
  </code></pre>
  
  <p>Here I am trying to call a method in a PHP file. That method contains a parameter.</p>
  
  <pre><code>public function correct($word)
          {
              $this-&gt;Flip2-&gt;correctAnswer(89,$word);
  
          }
  </code></pre>
  
  <p>However there is an issue in passing the parameter values to the PHP method. It simply do not work. If I remove the parameters from "all" the places and just call the <code>url: "http://localhost/cake2/flip2/correct",</code> this works fine. What I have done wrong when passing the values to the PHP method via the Ajax call?</p>