title: Return data Ajax - Mysql
body: <p>I'm trying to return data from a table using Mysql and Ajax, but got nothing in the variable. Connexion to database is Ok and the query is ok too.</p>
  
  <p>The table contains 2 ids, which I'm trying to retrieve :</p>
  
  <p><a href="https://i.stack.imgur.com/V5CqU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V5CqU.png" alt="enter image description here"></a></p>
  
  <p>process.php</p>
  
  <pre><code>&lt;?php
     $con = mysqli_connect('localhost','root','root','DBB');
     if (!$con) {
         die('Could not connect: ' . mysqli_error($con));
     }
  
  
     $sql="SELECT id FROM events";
     $result = mysqli_query($con,$sql);
  
     echo json_encode($result);
  
  ?&gt;
  </code></pre>
  
  <p>The Ajax function </p>
  
  <pre><code>&lt;script&gt;
  function print() {
  
      $.ajax({  
           url: "process.php",   
           dataType: 'json',
           success : function(data)
           {
               console.log(data); // OUTPUT
           } 
      });
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>Object {current_field: null, field_count: null, lengths: null, num_rows: null, type: null}
  </code></pre>