62,046
社区成员
发帖
与我相关
我的任务
分享
function Addit(ID)
{
$.ajax({
type:"GET",
url:"add.ashx",
dataType:"JSON",
cache: false,
data:"ID="+ID,
beforeSend:function(XMLHttpRequest)
{
},
success:function(msg)
{
alert(msg);
}
});
//我加了这句ff没弹出错误提示!你把你修改过的代码在发上来看看!还有jq用的是什么版本的?
$(document).ready(function(){
$("a").click(function(){
$.ajax({
url:"/Comment/Handler1.ashx",
type:"get",
//data:"ID=0",
data:"ID=1",
success:function(result){
alert(result);
},
error:function (XMLHttpRequest, textStatus, errorThrown)
{
alert(XMLHttpRequest.readyState);
}
})
})
})
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="ChildShoesWeb.Comment.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script type="text/javascript" src="/UserBackstage/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("a").click(function(){
$.ajax({
url:"/Comment/Handler1.ashx",
type:"get",
//data:"ID=0",
data:"ID=1",//你可以切换注释看下效果,我本地测试了
success:function(result){
alert(result);
}
})
})
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<a href="#">获取</a>
</div>
</form>
</body>
</html>
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
if (context.Request.QueryString["ID"] == "1")
{
context.Response.Write("成功!");
context.Response.End();
}
else
{
context.Response.Write("失败!");
context.Response.End();
}
}
success:function(msg)