ajax post 在 CLASSIC asp 中获得价值
我正在尝试使用 jquery AJAX 获取已发布文本框的值:
I am trying to get the value of the posted textbox using jquery AJAX:
这是我的代码:
$(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>
我得到的只是重新调整",之后什么都没有.我会做错什么?
All i get is "retuned" and nothing after that. What would i be doing incorrect?
大卫
推荐答案
你的 ajax 正在使用 POST
,ASP 需要使用 request.form
而不是request.querystring
- 或者,将您的 ajax 更改为 GET
.
Your ajax is using POST
, ASP will need to get the value using request.form
instead of request.querystring
- alternatively, change your ajax to GET
.
相关文章