Home  >  Article  >  Web Front-end  >  jQuery AJAX calls WebService implementation code_jquery

jQuery AJAX calls WebService implementation code_jquery

WBOY
WBOYOriginal
2016-05-16 18:31:23780browse

Use jQuery to call WebService of other projects
Implement login verification function
html enter username and password:
Code

Copy code The code is as follows:














Login ID:



Login Password:

< ;input id="txtLoginPW" type="password" style="width: 190px;" value="" />


< ;/td>




Jquery reference and login event
Code
Copy code The code is as follows:


://localhost:1742/SoldierServices.asmx";
WebService code:
Code




Copy code


The code is as follows :


///
/// 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.
Statement:
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