Py学习  »  Python

服务器端使用python的post请求句柄[duplicate]

Soumyajit Seal • 4 年前 • 180 次点击  

我已经安装了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);
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/47611
 
180 次点击  
文章 [ 2 ]  |  最新文章 4 年前