title: Sending json object from jsp to servlet
body: <p>I wanted to send name and password from jsp in the form of json to servlet but this is not working. 
  What might be the problelm?</p>
  
  <p>Here is my snippets.
  <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>function submitForm(thisObj, thisEvent) {
    var name = $('#name').val();
    var password = $('#password').val();
  
    var myData = {
      "mydata": {
        "name": name,
        "password": password
      }
    };
    $.ajax({
      type: "GET",
      url: "/Aasd",
      data: {
        jsonData: JSON.stringify(myData)
      },
      dataType: "json"
    });
    return false;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js”&gt;
  &lt;/script&gt;
  
  
  &lt;body&gt;
    &lt;h2&gt;Login&lt;/h2&gt;
    &lt;form enctype='application/json'&gt;
      Name:&lt;input type="text" value="name" id="name"&gt;&lt;br&gt; Password:
      &lt;input type="password" id="password"&gt;&lt;br&gt;
      &lt;input type="submit" name="submit" onclick=" return submitForm(this,event)"&gt;
    &lt;/form&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>