我试图弄清楚为什么我没有看到带有 $.post("/url/", {wtf: 2}) 的参数。
我正在使用这个 perl:
use strict;
use CGI;
my $cgi = new CGI;
print $cgi->header("text/javascript");
print "'no'";
use Data::Dumper;
warn Dumper({ (map {$_=>$cgi->param($_ )} $cgi->param), postdata=>$cgi->param("POSTDATA") });
当我发出 $.get("/url", {wtf: 2}) 时,我得到了我期望的结果,并在日志中发现 wtf 为 2。当我使用 $.post("/url/", {wtf: 2}) 时,我似乎根本没有得到任何参数(日志中只有一个 $VAR1 = { postdata=>undef })。
我错过了什么?
Firebug 显示:Transfer-Encoding 是“分块”,Content-Type 是“application/x-www-form-urlencoded; charset=UTF-8”。此外,Post 选项卡似乎显示了请求中的参数,但 CGI 没有任何乐趣。