title: Calling python program from html javascript form
body: <p>I am trying to make a webpage where I enter a latitude and longitude and a python program will process the latitude and longitude in the form of a graph.  For simplicity sake, in this question I just have the python program just repeat the latitude and longitude because I am wanting to know how to run the python program in the context of the html and javascript code and pass the arguments from the html form (latitude and longitude) into the python script.  Below is the html code:</p>
  
  <pre><code>&lt;html&gt;
  
  &lt;head&gt;
  
  &lt;script&gt;
  
      function set_iterations()
      {
         var count = 0;
         var lat = document.getElementById("lat").value;
         var lon = document.getElementById("lon").value;
         document.write("latitude is " + lat + " and longitude is " + lon + "&lt;/br&gt;"); 
        $.ajax({
           type: "POST"
           url: "testmaker.py" + lat + lon
         });
     }
  
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
         &lt;td style='border-right:none' align='center'&gt;Latitude: &lt;/td&gt;
         &lt;td style='border-right:none' align='center'&gt;&lt;input type=text id='lat' size=10&gt;&lt;/td&gt;
         &lt;td style='border-right:none' align='center'&gt;Longitude: &lt;/td&gt;
         &lt;td style='border-right:none' align='center'&gt;&lt;input type=text id='lon', size=10&gt;&lt;/td&gt;
         &lt;br&gt; 
         &lt;button style="width:200px;margin-top:5px;margin-bottom:20px;"   onClick="set_iterations();"&gt;Submit&lt;/button&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The python program is this:</p>
  
  <pre><code>  #!/usr/bin/python
  
    import sys
  
    latitude = sys.argv[1]
    longitude = sys.argv[2]
  
    print "Using coordinates: ",latitude,",",longitude
  </code></pre>
  
  <p>How should I modify this program so that the submit button on the form would call the python program with the entries in the form being command line arguments for the python program?</p>
  
  <p>"</p>