[英]Ajax not posting to data to classic asp page
I'm working with two classic asp pages. 我正在使用两个经典的ASP页面。 In the first page, I have a modal dialog box with a button that when clicked, is suppose to send data to the second asp page.
在第一页中,我有一个模式对话框,其中包含一个按钮,单击该按钮时,该对话框将向第二个ASP页发送数据。
The problem is that I'm getting a "success" callback when it's ran but that data is not being posted to the second page. 问题是我在运行时收到“成功”回调,但数据未发布到第二页。
Here is the first page: 这是第一页:
<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');
}
}
});
});
})
And here is where the data is supposed to be posted to: 这是应该将数据发布到的位置:
<% Dim test
test = Request("libid")
Response.Write test
%>
Your code first of all uses $.post()
to make a POST request with Ajax. 您的代码首先使用
$.post()
向Ajax发出POST请求。 If it gets a successful response, it ignores the data in that response and runs location.replace
to make a completely new GET request to the same URL. 如果成功获得响应,它将忽略该响应中的数据并运行
location.replace
以对同一URL发出全新的 GET请求。
The browser then displays the response to the GET response. 然后,浏览器将显示对GET响应的响应。
If you want to make a POST request and display the result as a new page, then submit a form. 如果您要发出POST请求并将结果显示为新页面,请提交表单。 Don't use Ajax.
不要使用Ajax。
You need to use Request.Form()
: 您需要使用
Request.Form()
:
<% Dim test
test = Request.Form("libid")
Response.Write test
%>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.