Ajax not to mention that we all understand, do not understand please Baidu or google some people than I said the professional, the author of this article is not to introduce many esoteric things, This is just a very simple example to guide everyone. This example is only to make it clear that the basic invocation of Ajax needs to do those things the author uses the VS2005 reference AJAX2.0 Assembly (Ajaxpro.2.dll).
In the Web.config file, add the following settings
3. Create a page default.aspx
4. Register the name of the Ajax callable class in the Page_Load of the Default.aspx.cs file
protected void Page_Load (object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax (typeof (_default));
}
5. Create Ajax-Callable methods:
[Ajaxpro.ajaxmethod]
public string SETTB (string name)
{
return name;
}
Note: [Ajaxpro.ajaxmethod] is the method that defines the Ajaxpro callable, and it must be noted
6. Front Code:
<%@ Page language= "C #" autoeventwireup= "true" codefile= "Default.aspx.cs" inherits= "_default"%>
! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
Untitled Page
function Comit_onclick ()
{
var Name=document.getelementbyid ("Tb1"). Value;
_DEFAULT.SETTB (Name,callback);
}
Function callback (RES)
{
document.getElementById ("TB"). Value=res.value;
}
]]>
Note: This is noteworthy here is _DEFAULT.SETTB (name,callback), this sentence is to invoke the _default.aspx.cs background code SETTB this method, If this method has no parameters to pass, indicate the return processing method is OK, written _DEFAULT.SETTB (callback);