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

How does Ajax enable the client to call the server asynchronously?

php中世界最好的语言
Release: 2018-03-30 15:39:09
Original
1400 people have browsed it

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 node of the project's webconfig, add Node

(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:

What are the ways to write regular rules to determine whether it is an integer, decimal or real number

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!

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!