title: Cordova - jquery ajax post to php on server
body: <p>I want to create an token based system, where I want to push the value of an input field to my server side php file to insert it into my database.</p>
  
  <p>Cordova html:</p>
  
  <pre><code>&lt;input type="text" class="valueToken" name="usertoken" &gt;
  &lt;button class="postToken"&gt;PostToken&lt;/button&gt;
  </code></pre>
  
  <p>Cordova js:</p>
  
  <pre><code>$('.postToken').click(function(){
    console.log($('.valueToken').val());
    var tokenValue = $('.valueToken').val();
  
  $.ajax({
      type: "POST",
      url: "http://domainName.com/fysioWebapp/php/get_token.php",
      data: { 'dataString': tokenValue },
      cache: false,
      success: function(){
          alert("Order Submitted");
      }
  });
  </code></pre>
  
  <p>});</p>
  
  <p>And here is my serverside php:</p>
  
  <pre><code>&lt;?php
  include("connect.php");
  
  $stringData = $_POST['tokenValue']; 
  echo $stringData
  
  $insertToken = "INSERT INTO User_Token VALUES ('$stringData')";
  $tokenresult = mysqli_query($conn, $sql);
  
   if($tokenresult){
      echo "Successful";
  }else {
          echo("Error description: " . mysqli_error($conn));
  }
  </code></pre>
  
  <p>?></p>
  
  <p>But it is not posting the data to my get_token.php file what am I missing here?</p>
  
  <p>With this as error on the cordova side: <code>POST http://domainName.com/fysioWebapp/php/get_token.php 500 (Internal Server Error)</code></p>