title: How to get variable from JavaScript to PHP
body: <p>i need to  transfer a variable from js to a php page then insert it in the database</p>
  <p>the Js code</p>
  <pre><code>    function tableText(tableCell) {
      var x =tableCell.innerHTML;
       console.log(x);
  }
  </code></pre>
  <p>also tried the ajax</p>
  <pre><code>function tableText(tableCell) {
      var x =tableCell.innerHTML;
      console.log(x);
      $.ajax({  
      type: 'POST',
      url: 'try.php', 
      data: x ,
      complete: function(text){
           return text; }
   });
  }
  </code></pre>
  <p>not sure if i got it right and i don't know how to call it in the php page</p>
  <p>so How to get variable from JavaScript to PHP  ??</p>