title: Jquery Ajax call to servlet
body: <p>I am trying to make an Ajax call using JQuery to a servlet that returns a JSON object.
  In the JSP page I have a form, at first I didn't know how the get the data from the form,
  then I found .serialize.</p>
  
  <p>I have the following JavaScript:</p>
  
  <pre><code>$(document).ready(function() {
      $("#submit").click(function blabla() {
          var formData = $('form').serialize();
          $.ajax({
              type: "POST",
              url: "/ArchiveSearch/Search",
              dataType: "json",
              data: formData,
          });
      });
  });
  </code></pre>
  
  <p>The information comes from the following form:</p>
  
  <pre><code>&lt;form method= post"&gt;
              &lt;div class="searchCiteria"&gt;
                  &lt;div id="searchValueBlock1"&gt;
                          &lt;div&gt;&lt;span class="label"&gt;Case ID:&lt;/span&gt;&lt;input type="text" name="messagecaseid"  size="25"/&gt;&lt;/div&gt;
                          &lt;div&gt;&lt;span class="label"&gt;Onderwerp:&lt;/span&gt;&lt;input type="text" name="messagesubject" size="25" /&gt;&lt;/div&gt;
                          &lt;div&gt;&lt;span class="label"&gt;Afzender:&lt;/span&gt;&lt;input type="text" name="messagesender"  size="25"/&gt;&lt;/div&gt;
                          &lt;div&gt;&lt;span class="label"&gt;Ontvanger:&lt;/span&gt;&lt;input type="text" name="messagereceiver"  size="25"/&gt;&lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;div id= "searchValueBlock2"&gt;
                      &lt;div&gt;&lt;span class="label"&gt;Datum:&lt;/span&gt;&lt;input type="text" name="date1"  size="25"/&gt;&lt;/div&gt;
                      &lt;div&gt;&lt;span class="label"&gt;&lt;/span&gt;&lt;input type="text" name="date2"  size="25"/&gt;&lt;/div&gt;
  
                      &lt;div class="submit"&gt;
                          &lt;input type="submit" value="Search"&gt; 
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;/form&gt;
  </code></pre>
  
  <p>When I use the action parameter in the form the servlet repondes like it should.
  But I can't seem to get the Ajax call to work.</p>
  
  <p>What am I doing wrong?</p>