Home > Web Front-end > JS Tutorial > body text

jQuery AJAX calls WebService implementation code_jquery

WBOY
Release: 2016-05-16 18:31:23
Original
782 people have browsed it

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.
Related labels:
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!