前台JS
<!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>
<title>New Document </title>
<script type="text/javascript" src="js/jquery-1.4.1.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
function aj(){
alert("fsdf");
var openId=null;//'0E0C36C83EA68C8058F9ACE3CBFDDCEE';
$.post(
"Handle.aspx",
{ openId:openId},
function (data){
alert("返回"+data);
if(data){
alert("0返回"+data);
window.location.href="http://cloud.suridea.cn/Index.aspx";
}else{
alert("1返回aa"+data);
window.location.href="http://cloud.suridea.cn/user/register.aspx?openid="+openId;
}
});
}
</script>
</head>
<body>
<span id="wb_connect_btn"></span>
<input id="Button1" onclick="aj();" type="button" value="button" />
</body>
</html>
后台cs
protected void Page_Load(object sender, EventArgs e)
{
if (HttpContext.Current.Request["openId"] != null)
{
Suridea.CloudService.Model.User user = new Suridea.CloudService.Model.User();
user.Remark = Request["openId"].ToString();
IList<User> u = userService.FindUsers(user);
bool result=false;
if (u.Count != 0)
{
result = true;
}
else {
result = false;
}
HttpContext.Current.Response.ContentType = "text/plain";
HttpContext.Current.Response.CacheControl = "no-cache";
HttpContext.Current.Response.Write(result);
HttpContext.Current.Response.Flush();
}
}
以上为我js代码 很头疼啊 处理代码
我代码异步回调成功了 返回data有时候明明是false却还是跑到if里面,然后我把data改为返回字符串还是if条件那判断感觉没起到效果。很头疼很急的问题 搞了一天了 都没弄出来哪的问题,希望帮忙快点解决,在线等。
慕码人8056858
红颜莎娜
牧羊人nacy
守着一只汪
阿晨1998
慕田峪9158850
DIEA
MMMHUHU
慕无忌1623718