title: Getting html input value with request.getParameter() / getAttribute() returns null
body: <p>I'm writing a web project and I need to pass information to and from my mySQL database. I have java code that works (i.e shows data from database , no problem there) and javascript that is supposed to handle the information.
  I have a form (name, last name and so on) and I need to check if the name , last name already exist in the database.<br>
  My problem is passing the text from the <code>&lt;input&gt;</code> field where the user writes to the java method.</p>
  
  <p>My input fields are in a form, the checking function is set "oninput" so every key stroke it checks .The input fields:</p>
  
  <pre><code>First name: &lt;input class="inName" type="text" id="FirstName" name="FirstName" oninput="checkExist()"/&gt;&lt;span id="info1" class="info"&gt;&lt;/span&gt;&lt;br&gt;
          Last name: &lt;input class="inLName" type="text" id="LastName" name="LastName" oninput="checkExist()"/&gt;&lt;span id="info2" class="info"&gt;&lt;/span&gt;&lt;br&gt;
  </code></pre>
  
  <p>the check function:</p>
  
  <pre><code>function checkExist(){
  
  
      &lt;%
      MyConnection myCon = MyConnection.getConnection();
      String fName = (String)request.getParameter("FirstName");
      String lName = (String)request.getParameter("LastName");
  
      String result = myCon.userExist(fName, lName);
  
      %&gt;
  
      var res = "&lt;%=result%&gt;"
  
      alert(res);
  }   
  </code></pre>
  
  <p>the alert indicates that the java function works properly.
  everything is fine except the request.getParameter() returns null instead of the input text.</p>
  
  <p>I tried :</p>
  
  <ol>
  <li><p>getAttribute</p></li>
  <li><p>putting .toString() at the end</p></li>
  <li><p>getElementByid() and try to pass it to the function (which does not work) </p></li>
  </ol>
  
  <p>and so on and so forth.<br>
  I can't seem to get it to work!<br>
  Any help would be much appreciated!</p>