title: Php file won't load ajax request
body: <p>I try query my database from javascript, using ajax request to my php file. This is my code:</p>
  <pre><code>&lt;?php
  include('db.php');
  session_start();
  ?&gt;
  
      &lt;!doctype html&gt;
      &lt;html lang=&quot;en&quot;&gt;
  
  &lt;body&gt;
      &lt;div class=&quot;container&quot;&gt;
          &lt;canvas id=&quot;myCanvas&quot; width=&quot;600&quot; height=&quot;100&quot;&gt;&lt;/canvas&gt;
          &lt;script src=&quot;jquery-3.5.1.min.js&quot;&gt;&lt;/script&gt;
          &lt;script src=&quot;trainPassFrequency.js&quot;&gt;&lt;/script&gt;
              ...
  </code></pre>
  <p>So I included jquery file into my folder, so that I can access it as shown above. Now my trainPassFrequency.js look like this:</p>
  <pre><code>function parseData(data) {
      console.log(data);
  }
  function trainFrequency() {
      $.post('ajaxRequests/trainfrequency.php'), {}, function (data) {
          console.log(data);
          if (typeof data === 'object') {
              parseData(data);
          }
      }
  }
  trainFrequency();
  </code></pre>
  <p>where trainfrequency.php only returns (echo) output of the sql query. When I run this code, I never get through <code>$.post('ajaxRequests/trainfrequency.php'), {}, function (data) {</code>. Can anyone see my mistake?</p>