title: Updating database OnClick() <a>
body: <p>I have been looking around here at many questions but it seems nothing works for me... It doesn't update the database.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function language(id,lang){
    $.ajax({
        url: 'modules/tca/updatedb.php',
        type: 'POST',
        data: 'id='+id+'&amp;lang='+lang,
     });
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;li&gt;&lt;a href="#en" onclick="return language($id,"en");"&gt;&lt;span class="flag flag-usa flag-1x"&gt;&lt;/span&gt; EN&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#fr" onclick="return language($id,"fr");"&gt;&lt;span class="flag flag-frc flag-1x"&gt;&lt;/span&gt; FR&lt;/a&gt;&lt;/li&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is my updatedb.php.</p>
  
  <pre><code>&lt;?php
  @include_once('setdb.php');
  $id = $_POST['id'];
  $lang = $_POST['lang'];
  
  mysql_query("UPDATE users SET lang='$lang' WHERE id = '$id' ");
  ?&gt;
  </code></pre>