用asp+jquery写的一个ajax小程序,不知怎么回事儿,返回值是jquery里边的那个html的源码。
ajax.html:
<html>
<head><title>t7</title>
<script type="text/javascript" src="jquery-1.6.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#send").click(function(){
$.ajax({
type:"get",
URL:"http://localhost/jquery/ajax.asp",
dataType:'text',
data:"{id:7}",
success: function(data, textStatus){
alert(data);
}
});
});
});
</script>
</head>
<body>
<input type="button" value="send" id="send"/>
</body>
</html>
ajax.asp:
<%
id=request("id")
t="small"
if id>3 and id<8 then
t="middle"
else t="big"
end if
response.write(t)
return;
%>
追问:asp里边的return;我去掉之后没有问题,直接运行http://localhost/jquery/ajax.asp可以,我用
$(document).ready(function(){
$("#send").click(function(){
$.get("ajax.asp",{Action:"get",id:"9"},function (data,textStatus){
alert(data);
});
});
});
这种方式运行,能出结果,但是另外一种还是不行。
答案:URL要小写的。
其他:那说明http://localhost/jquery/ajax.asp页面代码有误,你不防直接把参数放在该页面,运行该页面,看有什么错误吧,我以前也遇过这个问题,不是AJAX代码有问题,是你写的ASP代码页面有问题的
上一个:HTML 如何设置文本框中光标位置和光标居中
下一个:新手html求助