【发布时间】:2014-12-01 01:00:02
【问题描述】:
我在 Bluehost 上托管一个网站,我正在尝试使用 AJAX 在单击按钮时执行 python 脚本。但是,每次我单击按钮时,服务器都会向 python 脚本响应 500 错误。更具体地说,这是错误:
[Sun Nov 30 17:49:26 2014] [error] [client 174.61.70.33] 过早结束 脚本头:Steap.py,引用者:http://steap.co/
这是 AJAX 代码:
$(document).ready(function(){
$("#steambutton").click(function() {
DisplayLoadingDiv();
$.ajax({
type: "POST",
url: "http://steap.co/cgi-bin/Steap.py",
data: {steamid: "<?php echo $steamprofile['steamid']?>"},
success: function(response) {
$("#steamdiv").html(response);
$("#phisherbutton").show()
},
error: function(response) {
$("#steamdiv").html("An error occured. Please try again.");
}
});
});
});
基本上,div在执行0.01秒后显示"An error occured. Please try again.",控制台显示服务器在尝试加载python脚本资源时响应500错误。
Steap.py:
关于为什么会发生这种情况的任何想法?
【问题讨论】:
-
所以...
steap.co是您的服务器,对吧?您在该服务器日志中看到任何错误吗? -
steap.co 是网站,而不是服务器。这是服务器日志中的错误:
[Sun Nov 30 17:49:26 2014] [error] [client 174.61.70.33] Premature end of script headers: Steap.py, referer: http://steap.co/ -
Potato, poteito... :-D 那么
Steap.py到底在哪里运行呢?我的意思是......我看不出这里的一切是如何连接的......你正在向steap.co发送一个POST,它运行......谁知道在哪里......这给了你一个HTTP 500。 ..Steap.py在哪里发挥作用。 -
啊,我想我明白了……
-
Steap.py在我的站点目录的 cgi-bin 文件夹中。我只是向那个 cgi-bin 文件夹中的Steap.py资源发出一个帖子请求。
标签: python ajax http-headers cgi bluehost