Home > php教程 > php手册 > jQuery AJAX 调用 WebService 的实例

jQuery AJAX 调用 WebService 的实例

WBOY
Release: 2016-06-13 11:37:13
Original
927 people have browsed it

用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]默认是注释的,要把注释去掉
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template