当前位置: 代码迷 >> ASP.NET >> html+jquery项目发布,该如何处理
  详细解决方案

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

热度:258   发布时间:2013-02-25 00:00:00.0
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";
  } 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();            }            }            });
  相关解决方案