title: ajax in jsp call sql query when select dropdown value
body: <p>need help to get value from sql table in jsp when select from dropdown.</p>
  
  <p>when i select CL then I want to run a query in jsp get all record from sql table.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {
      $leavetype=  $('.leavetype');
      $leavetype.change(function (){
          var value =  $('.leavetype').val();
          $.ajax({
              type: "post",
              url: "applicationformuser.jsp", //this is my servlet
              data: {leavetype : value},
                  success: function(msg){      
                      alert(msg.data);
                  }
          });
      });
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"&gt;&lt;/script&gt;
  &lt;select class="leavetype" name="leavetype"style="position:absolute;margin-left:160px;margin-top:160px;height:30px;width:300px;"&gt;
      &lt;option value="CL"&gt;CL&lt;/option&gt;
      &lt;option value="ML"&gt;ML&lt;/option&gt;
      &lt;option value="SL"&gt;SL&lt;/option&gt;
      &lt;option value="EL/PL"&gt;EL/PL&lt;/option&gt;
      &lt;option value="CPL"&gt;CPL&lt;/option&gt;
  &lt;/select&gt;</code></pre>
  </div>
  </div>
  </p>