首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

html+jquery项目发布,该如何处理

2012-04-28 
html+jquery项目发布项目是使用Html+jquery提交数据到httphandle里面访问数据库,问题是:代码在vs中运行没

html+jquery项目发布
项目是使用Html+jquery提交数据到httphandle里面访问数据库,问题是:代码在vs中运行没有问题,但是发布到IIS中
 $.ajax({
  type: "POST",
  cache: false,
  data: "username=" + username + "&password=" + password + "",
  url: "Handle/LoginHandler.ashx",
  success: function(data) {
  if (data == "帐号登录成功") {
  window.location.href = "Index.html";
  } else {
  alert(data);
  }
  }, error: function(data) {
  alert("登录失败");
  }
  });
一直执行error块,而不执行success块,不知是什么原因,求解决方法。

[解决办法]

C# code
 $.ajax({            type:"post",//请求方式            url:"../ajax/AjaxLogin.ashx",//载入页面的URL地址            data:{username:$("#TxtUserName").val(),userpwd:$("#TxtUserPwd").val()},            success:function(data){//返回成功的函数            if(data =="0"){            show();            setTimeout("window.location.href='../FrameSet/FatherFrame.aspx';",700);            }else            {                alert('账号密码错误或您的账号未被启用!');                document.getElementById("TxtUserName").value="";                document.getElementById("TxtUserPwd").value="";                document.getElementById("TxtUserName").focus();            }            }            }); 

热点排行