title: check database in javascript
body: <p>I am working on project based on jsp and servlet and in that, on 1 of the page there is an option(dropdown list).In that I want to check if the current selected value is in database or not.Currently it works but when I click a button button but I want to check whenever the value from dropdown list changes.</p>
  
  <p>Example-</p>
  
  <pre><code>&lt;select id="abc"&gt;
  &lt;option value="1"&gt;test1&lt;/option&gt;
  &lt;option value="2"&gt;test2&lt;/option&gt;
  &lt;option value="3"&gt;test3&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Now for javascript I did-</p>
  
  <pre><code>&lt;script&gt; 
  var e = document.getElementById("abc");
  var str = e.options[e.selectedIndex].text;
  &lt;/script&gt;
  </code></pre>
  
  <p>Now how do I check this str value in database in jsp??</p>
  
  <p>I think it can be done by javascript but not sure and also don't know how to check value from database in script tag.It might be ajax also please help</p>