title: Enter ID in html form and load related data from MySQL database in same page
body: <p>I have a form with an input field for a userID. Based on the entered UID I want to load data on the same page related to that userID when the user clicks <code>btnLoad</code>. The data is stored in a MySQL database. I tried several approaches, but I can't manage to make it work. The problem is not fetching the data from the database, but getting the value from the input field into my php script to use in my statement/query.
  What I did so far:
  I have a form with input field <code>txtTest</code> and a button <code>btnLoad</code> to trigger an ajax call that launches the php script and pass the value of txtTest. 
  I have a div on the same page in which the result of the php script will be echoed.<br>
  When I click the button, nothing happens...</p>
  
  <p><strong>Test.html</strong></p>
  
  <pre><code>&lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"&gt;&lt;/script&gt;  
  &lt;script&gt;
  //AJAX CALL
  function fireAjax(){
              $.ajax({
                  url:"testpassvariable.php",
                  type:"POST",
                  data:{userID:$("#txtTest").val(),},
                  success: function (response){
                      $('#testDiv').html(response);
                  }
              });
          }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form name="testForm" id="testForm" action="" method="post" enctype="application/x-www-form-urlencoded"&gt;
  &lt;input type="text" name="txtTest" id="txtTest"/&gt;
  &lt;input type="button" id="btnLoad" name="btnLoad" onclick="fireAjax();"
  &lt;input type="submit" name="SubmitButton" id="SubmitButton" value="TEST"/&gt;
  &lt;/form&gt;
  &lt;div id="testDiv" name="testDiv"&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>The submit button is to insert updated data into the DB. I know I have to add the "action". But I leave it out at this point to focus on my current problem.</p>
  
  <p><strong>testpassvariable.php</strong></p>
  
  <pre><code>&lt;?php
  $player = $_POST['userID'];
  echo $player;
  ?&gt;
  </code></pre>
  
  <p>For the purpose of this script (testing if I can pass a value to php and return it in the current page), I left all script related to fetching data from the DB out.</p>