title: Unable to send data to MySQL via AJAX / PHP
body: <p>I'm having difficulties send data to MySQL via PHP and a Jquery ajax call, I'm new to this so apologies if its something obvious - any help would be appreciated.</p>
  
  <p>connect database php</p>
  
  <pre><code>&lt;?php
   DEFINE ('DB_USER', 'user account');
   DEFINE ('DB_PSWD', 'password');
   DEFINE ('DB_HOST', 'localhost');
   DEFINE ('DB_NAME', 'dbname');
   $dbcon = mysqli_connect(DB_HOST, DB_USER, DB_PSWD, DB_NAME);     
  ?&gt;
  </code></pre>
  
  <p>call.php:</p>
  
  <pre><code>&lt;?php   
  include(connect_db.php);
  $name = $_POST['name'];
  $age = $_POST['age'];
  
  mysql_query("INSERT INTO user ('name', 'age') VALUES ('$name','$age')");
    ?&gt;
  </code></pre>
  
  <p>ajax call:</p>
  
  <p>The name and age are added via function</p>
  
  <pre><code>function send (name, age) {
   $.ajax({
  type: "POST",
  url : "scripts/call.php",           
  data : "name=" + name + "&amp;age=" + age,
  success: function(data) {
      console.log('success');
  },
  error: function () {
          console.log('failed');
  }
    });
   }
  </code></pre>
  
  <p>I do get a success console.lo however no data is every shown in the database. </p>
  
  <p>Thanks, 
  Stephen</p>