我已经安装了apache2并且python正在工作。
不过,我有个问题。我有两页纸。
一个是python页面,另一个是带有jquery的html页面
有人能告诉我怎样才能让我的ajax帖子正常工作吗?
<html>
<head>
</head>
<body>
<script>
$(function()
{
alert('Im going to start processing');
$.ajax({
url: "saveList.py",
type: "post",
data: {'param':{"hello":"world"}},
dataType: "application/json",
success : function(response)
{
alert(response);
}
});
});
</script>
</body>
</html>
以及python代码
import sys
import json
def index(req):
result = {'success':'true','message':'The Command Completed Successfully'};
data = sys.stdin.read();
myjson = json.loads(data);
return str(myjson);