Home > Article > Web Front-end > How does Ajax enable the client to call the server asynchronously?
This time I will show you how Ajax implements the client's asynchronous call to the server. What are the precautions for Ajax to implement the client's asynchronous call to the server. The following is a practical case, let's take a look.
How to use ajax, call the same way in the cs file in js, the steps are as follows
(1) Download ajax.dll , and add the project's reference.
(2) In the
(3) Add Ajax.Utility.RegisterTypeForAjax(typeof(ClassName)); in the pageload method of the aspx page; the ClassName here is the class of the current cs file name.
(4) All methods written in cs that you want to call in js must be preceded by [Ajax.AjaxMethod()]. If you want to call session , then it should be written as: [Ajax.AjaxMethod(HttpSessionStateRequirement.Read)].
(5) In the js method, write var address = ClassName.MethodName('parameter').value; //ClassName is the class name, MethodName is the method name, and the passed-in parameter is parameter.
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
How to correct the regular rules of JS Negative integers that verify non-zero
The above is the detailed content of How does Ajax enable the client to call the server asynchronously?. For more information, please follow other related articles on the PHP Chinese website!