title: POST data to Python CGI script via jQuery AJAX
body: <p>I'm trying to setup a simple script where some data is sent using the jQuery .ajax function to a Python CGI script. The Python script would just make the data posted to it uppercase, and then return that data to the HTML file, where a div would be updated with the content.</p>
  
  <p>I have the code shown below. When I run it, the AJAX call executes, but <strike>the div is not updated with the content.</strike> the div is not updated with the data being sent.</p>
  
  <p>How would I modify this code so that it updates with the data being sent?</p>
  
  <p>I appreciate any help at all.</p>
  
  <p>My HTML Code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="content-type" content="text/html;charset=UTF-8"&gt;
      &lt;title&gt;Python-jQuery Example&lt;/title&gt;
      &lt;script src="http://code.jquery.com/jquery-2.0.3.js"&gt;&lt;/script&gt;
      &lt;script&gt;
          $(function()
          {
              $.ajax({
                  url: "http://localhost/cgi-bin/post.py",
                  type: "post",
                  datatype: "html",
                  data: "here is data",
                  success: function(response){
                          $("#div").html(response);
                          console.log("There is a response"); 
                  }
              });
          });
  
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id="div"&gt;Default Stuff&lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>My Python Code:</p>
  
  <pre><code>#!/usr/bin/python
  
  import cgi, cgitb 
  cgitb.enable() 
  
  data = cgi.FieldStorage()
  
  print "Content-Type: text/html"
  print data
  </code></pre>
  
  <p><strong>EDIT: I have updated my code to what is currently shown, and now the document updates with this string:</strong></p>
  
  <pre><code>FieldStorage(None, None, []) 
  </code></pre>
  
  <p><strong>How would I modify my code so that the div updates with the data being sent?</strong></p>