title: How to call php class methods in ajax
body: <p>I'm trying to retrive some code from a php method using ajax, when a person click a div.</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;div class="contenitore"&gt;
      &lt;div&gt;
          &lt;input class="idCommento" value="//some number"&gt;
      &lt;/div&gt;
      &lt;div&gt;
          &lt;p class="vediRisp"&gt;Create text&lt;/p&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="contenitore"&gt;
      &lt;div&gt;
          &lt;input class="idCommento" value="//some number"&gt;
      &lt;/div&gt;
      &lt;div&gt;
          &lt;p class="vediRisp"&gt;Create text&lt;/p&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>PHP (lib/Users.class.php)</p>
  
  <pre><code>Class Users{
      public function dammi_i_commenti(arguments){
          return '&lt;div&gt;code&lt;/div&gt;';
      }
  }
  </code></pre>
  
  <p>(lib/ottieniCose.php)</p>
  
  <pre><code>require('Users.class.php');
  $login = New Users;
  
  $GLOBAL['current'] == $_GET['adesso'];
  print $login-&gt;dammi_i_commenti();
  </code></pre>
  
  <p>AJAX</p>
  
  <pre><code>$(".vediRisp").on('click', function() {
      var mh = $(this).parentsUntil(".contenitore").find(".idCommento");
      var eeeh = mh.val();
      $.ajax({
          url: "lib/ottieniCose.php",
          type: "GET",
          data: {
              adesso: eeeh,
          },
      })
      .done(function() {
          console.log("success");
      })
      .fail(function() {
          console.log("error");
      })
      .always(function() {
          console.log("complete");
      });
  });
  </code></pre>
  
  <p>When i click the <code>.vediRisp</code> in the console i can read <code>success</code>, then <code>complete</code>, so I'm thinking that the click and ajax function work, but the page doesn't seem to update its content therefore i think that i'm not calling the method correctly. Anyway if i try to write <code>var_dump("stuff")</code> or <code>print_r("stuff")</code> in the ottieniCose.php file i get absolultely no result at all, and my guess is that i'm not using the ajax function correctly, or the ottieniCose.php file isn't called.
  Any help?</p>