用jQuery调用其他项目的WebService
实现登录验证功能
html输入用户名密码:
代码
Jquery引用和登录事件
代码
serviceURL类似:var serviceURL = "http://localhost:1742/SoldierServices.asmx";
WebService代码:
代码
///
/// Summary description for SoldierServices
/// [WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class SoldierServices : System.Web.Services.WebService
{
[WebMethod]
public User UserLogin(string UserLoginID, string UserLoginPW)
{
LoginBusiness lb = new LoginBusiness();
return lb.UserLogin(UserLoginID, UserLoginPW);
}
[WebMethod]
public User GetUserInfo(string UserID)
{
LoginBusiness lb = new LoginBusiness();
return lb.GetUserInfo(UserID);
}
}
Note: [System.Web.Script.Services.ScriptService] is commented by default. You need to remove the comments.
http://www.bkjia.com/PHPjc/364545.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/364545.htmlTechArticleUse jQuery to call the WebService of other projects to implement the login verification function html enter the username and password: Code table style=width: 400px tr td style=width: 200px class=left Login ID: /td td s...