title: JQuery $.ajax() post - data in a java servlet
body: <p>I want to send data to a java servlet for processing.  The data will have a variable length and be in key/value pairs:</p>
  
  <pre><code>{ A1984 : 1, A9873 : 5, A1674 : 2, A8724 : 1, A3574 : 3, A1165 : 5 }
  </code></pre>
  
  <p>The data doesn't need to be formated this way, it is just how I have it now.</p>
  
  <pre><code>var saveData = $.ajax({
        type: "POST",
        url: "someaction.do?action=saveData",
        data: myDataVar.toString(),
        dataType: "text",
        success: function(resultData){
            alert("Save Complete");
        }
  });
  saveData.error(function() { alert("Something went wrong"); });
  </code></pre>
  
  <p>The <code>$.ajax()</code> function works fine as I do get an alert for "Save Complete". My dilemna is on the servlet.  How do I retrieve the data?  I tried to use a HashMap like this...</p>
  
  <pre><code>HashMap hm = new HashMap();
  hm.putAll(request.getParameterMap());
  </code></pre>
  
  <p>...but <code>hm</code> turns out to be null which I am guessing means the <code>.getParameterMap()</code> isn't finding the key/value pairs. Where am I going wrong or what am I missing?</p>