当前位置:Gxlcms > PHP教程 > jQueryAJAX调用WebService的实例_PHP教程

jQueryAJAX调用WebService的实例_PHP教程

时间:2021-07-01 10:21:17 帮助过:5人阅读

用jQuery调用其他项目的WebService

实现登录验证功能

html输入用户名密码:

代码














Login ID:



Login Password:








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);
}
}

注意:[System.Web.Script.Services.ScriptService]默认是注释的,要把注释去掉

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/364545.htmlTechArticle用jQuery调用其他项目的WebService 实现登录验证功能 html输入用户名密码: 代码 table style=width: 400px tr td style=width: 200px class=left Login ID: /td td s...

人气教程排行