title: Jsp ajax call using jquery
body: <p>I have this code snippet where I am passing data to another jsp file.</p>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>$(document).ready(function() {
      $("#click").click(function() {
          name = $("#name").val();
          age = $("#age").val();
          $.ajax({
              type : "POST",
              url : "pageTwo.jsp",
              data : "name=" + name + "&amp;age=" + age,
              success : function(data) {
                  $("#response").html(data);
              }
          });
      });     
  });     
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;body&gt;
      Name:&lt;input type="text" id="name" name="name"&gt;
      &lt;br /&gt;&lt;br /&gt; 
      Age :&lt;input type="text" id="age" name="age"&gt;
      &lt;br /&gt;&lt;br /&gt;
      &lt;button id="click"&gt;Click Me&lt;/button&gt;
      &lt;div id="response"&gt;&lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>and in <strong>pageTwo.jsp</strong>, my code is</p>
  
  <pre><code> &lt;%
     String name = request.getParameter("name");
     String age = request.getParameter("age");
     out.println(name + age);
   %&gt;
  </code></pre>
  
  <p>but this is not working.Is any mistake in my Jquery ?.Can any one please help me?.  </p>