ajax在CLASSIC asp中获得价值
我试图使用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页面:
我的表格是:
我得到的只是“重新调整”,之后什么都没有。 我做错了什么?
大卫
你的ajax正在使用POST
,ASP需要使用request.form
而不是request.querystring
来获取值 – 或者,将你的ajax更改为GET
。
您的表单是POSTing,因此您无法访问通过Request.QueryString
发送的变量,而是通过Request.Form
。 或者,将您的ajax调用更改为type:'get'
。