title: Retrieving POST data from Web2py to local HTML file
body: <p>I've been having some heavy jquery cross-domain issues, so I've been trying to get around that through web2py.</p>
  
  <p>I'm sending POST data from a local HTML file to my web2py server.  Web2py is then making a python POST to a second server (which solves the cross-domain issue) and gets the expected response.  How should I get that response back to my local html file?  </p>
  
  <p>I've thought about storing those results in a database and then retrieving them with a url redirect-- but I'm not sure that I'd be able to guess what URL I would need.  Perhaps just grab the last entry from the database.</p>
  
  <p>Or is there a better method?  </p>
  
  <p>I realize there are probably much better methods to do this directly from the original local html file and circumvent web2py completely, but I'm much more comfortable in python than js.</p>
  
  <p>So I'm trying to get from:</p>
  
  <p>[local html file]->[POST to web2py]->[POST to other separate server]->[RESPONSE back to local html file] </p>
  
  <p>I just can't get that last leg figured out.</p>
  
  <p>My controller that posts to the 2nd server (this works):</p>
  
  <pre><code>def index():
      response.headers['content-type'] = 'text/xml'
      xml = request.body.read()  
      query_args = { 'data': xml }
      encoded_args = urllib.urlencode(query_args)
      url = 'myserver.com'
      content = urllib2.urlopen(url, encoded_args).read()
      return response.render(dict(content=XML(content)))
  </code></pre>
  
  <p>my local html file post looks like (this POSTS correctly):</p>
  
  <pre><code>&lt;script language="javascript"&gt;
  function check()
   {
  
  jQuery('.myclass').each(function(){ 
         var txt = $(this).serialize();   
              $.ajax({
      type: 'POST',
      url: 'myserver',
  data:  'mydata',
  statusCode: {
      302: function() {
          alert("302"); // this is never called
      },
      200: function() {
          alert("200");
      },
  },
  success: function (data, textstatus) {
      console.log(data);
  
  },
  error: function (data) {
  },
  
  });
  
  });
   }
  
  &lt;/script&gt;
  </code></pre>