从ajax获取python结果

2024-04-16 16:00:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试从ajax获取python结果

我的代码:web

<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
    <script type="text/javascript">

            $.ajax({
                    type: "POST",
                    url: "test.py",
                    success: function(response){
                            alert(response);
                    }
            });

    </script>

Python

print("hello! result get!")

但我执行这个代码 结果是

此代码的结果 enter image description here

相反,可见的结果是代码

这个代码有什么问题?你知道吗

解决了!编辑

启用apache cgi模式,然后求解!你知道吗


Tags: 代码textsrccomwebhttpresponsetype