title: Run jquery function when click on bootstrap tab
body: <p>I want to run an ajax function when I click on bootstrap tab.</p>
  
  <p>I have html:</p>
  
  <pre><code>  &lt;li&gt;&lt;a href="#upotrebljeni" data-toggle="tab"&gt;Upotrebljeni resursi&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <p>jquery ajax function:</p>
  
  <pre><code>$('a #upotrebljeni').click(function (e) {
  var ajdi = '22';
  var radnici = 'radnici';
  var prvi = '1'; 
      $.ajax({
              url: 'getRMZ.php', // make this url point to the data file
              dataType: 'json',
              data:{id_akt:ajdi, tabela:radnici, prvi:prvi},
              async: false,
          type: 'POST',
              success:function(data){
              console.log(data);
              },
          error:function(data) {
          console.log(data);
          }
  
          });
  
  });
  </code></pre>
  
  <p>and getRMZ.php pdo file:</p>
  
  <pre><code>try {
        /* Establish the database connection */
        $conn = new PDO("mysql:host=localhost;dbname=$dbname", $username, $password);
        $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  
       $result = $conn-&gt;query("SELECT id_tabele,naziv FROM track_aktivnosti WHERE prvi = :prvi AND id_akt = :id_akt AND tabela = :tabela");
       $result-&gt;execute(array(':prvi' =&gt; $_POST['prvi'], ':id_akt' =&gt; $_POST['id_akt'], ':tabela' =&gt; $_POST['tabela']));
  
      $jsonTable = json_encode($result);
      } catch(PDOException $e) {
          echo 'ERROR: ' . $e-&gt;getMessage();
      }
      echo $jsonTable;
  </code></pre>
  
  <p>Now when I click on tab a #upotrebljeni I dont get any action, any error, nothing ... What can be a problem here?</p>
  
  <p><strong>UPDATE: I via ajax get an error:</strong> "ERROR: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':prvi AND id_akt = :id_akt AND tabela = :tabela' at line 1"</p>