- 获取application/x-www-form-urlencoded数据
前端代码
var xmlHttp = new XMLHttpRequest();
var url = "/test.py";
xmlHttp.open("get", url, true);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
}
xmlHttp = null;
}
};
xmlHttp.send("test=123")
后台代码
#!/usr/bin/python
import cgi, cgitb
form = cgi.FieldStorage()
value= form.getvalue('test')
print "Content-type:text/html\r\n\r\n&#