ajax post在经典asp中获得价值
我正在尝试使用jquery AJAX获取发布的文本框的值: 这是我的代码:ajax post在经典asp中获得价值,ajax,jquery,post,asp-classic,Ajax,Jquery,Post,Asp Classic,我正在尝试使用jquery AJAX获取发布的文本框的值: 这是我的代码: $(document).ready(function(){ $('#submitButton').click(function() { $.ajax({ type: "POST", url: "test.asp", data: $("#form1").serialize(), cache: false,
$(document).ready(function(){
$('#submitButton').click(function() {
$.ajax({
type: "POST",
url: "test.asp",
data: $("#form1").serialize(),
cache: false,
dataType: "html",
success: function(responseText){
alert(responseText);
},
error: function(resposeText){
alert(resposeText);
},
});
return false;
});
});
这是test.asp页面:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
dim vwPW
vwPW = request.QueryString("vwPW")
response.write "returned " & vwPW
%>
我的表格是:
<form id="form1" method="post" action="">
<table width="100" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="vwPW" id="vwPW" type="password" class="textBox" maxlength="10" /></td>
<td><button class="GreyB" id="submitButton" name="submitButton"><span style="color:#000">Log in</span></button></td>
</tr>
</table>
</form>
登录
我得到的只是“重新调谐”,之后什么都没有。我会怎么做
David您的表单正在发布,因此您无法通过
Request.QueryString
访问发送的变量,而是通过Request.form
访问。或者,将ajax调用更改为类型:'get'
您的ajax正在使用POST
,ASP将需要使用request.form
而不是request.querystring
-或者,将您的ajax更改为get
谢谢,我知道这是个小问题。