修改客户端的wsgi集成
mod wsgi integration with client side
我有以下代码发送数据(参数)到mod_wsgi文件在该文件中有'应用程序'函数我如何从我的应用程序函数读取参数值(那些我从我的js发送)?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
<!--
function onTest( dest, params )
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById( "bb" ).innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("POST",dest,true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
debugger;
xmlhttp.send( params );
}
-->
</script>
</head>
<p id="bb"> abcdef </p>
<a href="javascript:onTest('wsgi_app.py', 'user=dan&pwd=1234')">Click it</a>
mod_wsgi代码:
def application(environ, start_response):
output = ChildClass().getValue()
print( output)
status = '200 OK'
stroutput = ''
for iterating_var in output:
values = ','.join(str(v) for v in iterating_var)
#str = ''.join(output[0])
print('second ' + values)
stroutput += '&&' + values
#print(str.encode('UTF-8'))
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(stroutput)))]
start_response(status, response_headers)
return [stroutput.encode('UTF-8')]
我是这样解决的:
request_body_size = int(environ['CONTENT_LENGTH'])
request_body = environ['wsgi.input'].read(request_body_size)
strBody = str(request_body)
相关文章:
- 如何检测用于WebGL的专用或集成显卡
- 在我的SPA应用程序中集成Facebook共享的问题
- vaadin:使用自定义布局集成angular js
- React ajax数据集成
- 有没有一个抽象层,这样我就可以集成一次,然后使用pusher、pubnub或faye
- IE中关于ZK和JavaScript集成的一些错误
- 如何将拼写检查集成到密文编辑器
- 将外部文件与AngularJs集成
- 如何将tesseract OCR与Cordova/Phonegap应用程序集成
- Cordova Facebook登录集成cordovaOauth
- 如何在Angular js中集成其他页面中的样式
- 性能与模块化:将JS集成到PHP或单独的custom.JS中
- Meteor集成测试,在velocity'她的镜子上有茉莉花
- Okta与JavaScript的集成
- 将prettyPhoto集成到Wordpress主题中
- 将epub.js集成到firefox中,作为.epub的默认读取器
- 在Meteor:p5.AudioIn()中集成p5.sound.js不是构造函数
- 如何将现有的angular js应用程序集成到Laravel 5中
- 如何将FBjavascript API与我的后台集成
- 修改客户端的wsgi集成