title: django/ajax: Unable to get Ajax post data in the views.py
body: <p>I had a problem getting ajax post data from django backend, I don't know how to pass the value, please help.</p>
  
  <p>In html I have simply this:</p>
  
  <pre><code>&lt;form id="get_vulns_from_family"&gt;
      &lt;label for="family_content"&gt;Enter a family name to display the NVTs&lt;/label&gt;
      &lt;input id="family_content" /&gt;
      &lt;input type="submit" value="search" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>In javascript I wrote this:</p>
  
  <pre><code>$(function() {
      $("#get_vulns_from_family").submit(function(event) {
          var family_text = $("#family_content").val();
          var family_data = {"family": family_text};
          $.ajax({
              url: "/template_conf/get_vulns_from_family",
              type: "POST",
              data: family_data,
              success: function(response) {
                  console.log(response);
              },
              error: function(response) {
                  console.log("failed!");
              }
          });
          // prevent default posting of form
          event.preventDefault();
      });
  });
  </code></pre>
  
  <p>In Django method corresponding to url <code>/template_conf/get_vulns_from_family</code>, I tried this:</p>
  
  <pre><code>def get_vuln_from_family(request):
      family = request.POST['family']
      # some other operations to get value for variable "json_data"
      return HttpResponse(simplejson.dumps(json_data))
  </code></pre>
  
  <p>But django said: <code>MultiValueDictKeyError: "Key 'family' not found in &lt;QueryDict: {}&gt;"</code>, which means the POST dictionary is empty.
  Am I using the wrong way to get post data? If so what should I do? Thanks.</p>