1 "Front desk
First, you need a Jquer package.
<script src= "Js/jquery-1.9.1.js" type= "Text/javascript" ></script> below is <script type= "text/ JavaScript > $ (function () { $ (' #txtUserName '). blur (function () { var username = $ (this). Val (); $.ajax ({ type: "Post", ContentType: "Application/json",//value-in-A-way URL: "Webajaxforme.aspx/getvalueajax", Webajaxforme.aspx is the target file, Getvalueajax is the method data in the target file : "{username: '" + Username + "'}",//username success:function (Result) { alert (RESULT.D),//result.d returned as a background } }) for the background pass parameter (the parameter is optional) }) }) </script>//here is the source of the parameter <input id= "txtUserName" type= "text"/>
2 "Backstage
In the background, you first add the using System.Web.Services;
[webmethod]//method must be added in front of [WebMethod] public static string Getvalueajax (string user Name)//This method needs to be static method to use the keyword static {//here can be passed in the parameters of any operation return username; }