ajax后得到CLASSIC asp中的值html
问题描述:
我正在尝试使用jquery ajax json获取我从一个页面发送到另一个页面的值。ajax后得到CLASSIC asp中的值html
这是我的代码:
function checkTheVin()
{
$.ajax({
type: "POST",
url: "checkVin.asp",
data: 'theVIN=' + $("#vwVin").val(),
cache: false,
dataType: "html",
beforeSend: function() {$.blockUI({ message: '<img src="img/ajax-loader.gif" />' });},
complete: function(){$.unblockUI();},
success: function(responseText){
if (responseText.indexOf("GOOD") > -1)
{
$("#theContent").html(responseText.replace("GOOD",""));
}else{
//alert(data);
}
},
error: function(responseText){alert('err: ' + responseText);},
});
}
但是我从来没有得到一个resonse回来。它是空的。
这就是我如何使用传统的ASP得到它:
dim vwVin
vwVin = request.QueryString("theVIN")
我在做什么不正确?
大卫
答
尝试在你的Ajax调用使用GET
方法:
$.ajax({
type: "GET",
url: "checkVin.asp",
data: 'theVIN=' + $("#vwVin").val(),
cache: false,
dataType: "html",
beforeSend: function() {$.blockUI({ message: '<img src="img/ajax-loader.gif" />' });},
complete: function(){$.unblockUI();},
success: function(responseText){
if (responseText.indexOf("GOOD") > -1)
{
$("#theContent").html(responseText.replace("GOOD",""));
}else{
//alert(data);
}
},
error: function(responseText){alert('err: ' + responseText);},
});
答
你有三个选择
使用Request对象但不指定集合
dim vwVin
vwVin = request("theVIN")
然后,Web服务器将为您搜索请求集合,首先查询字符串,然后是表单。
2.如果你正在使用Ajax后
$.ajax({ type: "POST", ...
dim vwVin
vwVin = Request.Form("theVIN")
指定,如果你正在使用的Request.QueryString集合指定Request.Form集合阿贾克斯GET
$.ajax({ type: "GET", ...
dim vwVin
vwVin = Request.QueryString ("theVIN")