繁体   English   中英

Ajax无法发布到经典ASP页面的数据

[英]Ajax not posting to data to classic asp page

我正在使用两个经典的ASP页面。 在第一页中,我有一个模式对话框,其中包含一个按钮,单击该按钮时,该对话框将向第二个ASP页发送数据。

问题是我在运行时收到“成功”回调,但数据未发布到第二页。

这是第一页:

<script>
$(function() {
    $("#SendNegAdj").click(function() {
        $("#dialog").dialog({
            title:"Send Negative Adjustment",
            width: 400,
            height: 200,
            modal: true,
            buttons: {
                Send:
                function(){
                    $.post("http://test.asp",
                    {libid:"test"});
    console.log(libid);

                    //$(this).dialog('close');
                },
                Close:
                function(){
                    $(this).dialog('close');
                }
            }
        });
    });
})

这是应该将数据发布到的位置:

<% Dim test
test = Request("libid")
Response.Write test
%>

您的代码首先使用$.post()向Ajax发出POST请求。 如果成功获得响应,它将忽略该响应中的数据并运行location.replace以对同一URL发出全新的 GET请求。

然后,浏览器将显示对GET响应的响应。

如果您要发出POST请求并将结果显示为新页面,请提交表单。 不要使用Ajax。

您需要使用Request.Form()

<% Dim test
  test = Request.Form("libid")
  Response.Write test
%>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM