<script type="text/javascript">
$("#LYF_Button1").click(function()
{
var username=document.getElementById("LYF_Text1").value;
var userpass=document.getElementById("LYF_Password1").value;
$.ajax
({
url:"WebService.asmx/Login",
type:"POST",
cache:false,
dataType:"xml",
data:"UserName=username&UserPassword=userpass",
success:function(res)
{
var as = $(res).find("int").text();
alert(as);
}
})
})
</script>WEB服务方法
public int Login(string UserName, string UserPassword)
{
if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(UserPassword))
{
return -1;
} UserDAL userdal = new UserDAL();
UserInfo userData = userdal.Getuser(UserName);
if (userData.UserPass == UserPassword)
{
return userData.UserID;
}
else
{
return 0;
}
}
请求WEB服务的一端是用的2个textbox来提供参数,但是参数老穿不过去,请大仙们支点下,感激不尽。
$("#LYF_Button1").click(function()
{
var username=document.getElementById("LYF_Text1").value;
var userpass=document.getElementById("LYF_Password1").value;
$.ajax
({
url:"WebService.asmx/Login",
type:"POST",
cache:false,
dataType:"xml",
data:"UserName=username&UserPassword=userpass",
success:function(res)
{
var as = $(res).find("int").text();
alert(as);
}
})
})
</script>WEB服务方法
public int Login(string UserName, string UserPassword)
{
if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(UserPassword))
{
return -1;
} UserDAL userdal = new UserDAL();
UserInfo userData = userdal.Getuser(UserName);
if (userData.UserPass == UserPassword)
{
return userData.UserID;
}
else
{
return 0;
}
}
请求WEB服务的一端是用的2个textbox来提供参数,但是参数老穿不过去,请大仙们支点下,感激不尽。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货