本文介紹了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
.
這篇關于ajax post 在 CLASSIC asp 中獲得價值的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!