Ajax client asynchronously calls the implementation method of the server (js calls the cs file), ajaxcs

Source: Internet
Author: User

Ajax client asynchronously calls the implementation method of the server (js calls the cs file), ajaxcs

The following describes how to use ajax to call the method in the cs file in javascript:

(1) download ajax. dll and add a reference to the project.

(2) add <add verb = "POST, GET" path = "ajax /*. ashx "type =" Ajax. pageHandlerFactory, Ajax "/> node

(3) add Ajax. Utility. RegisterTypeForAjax (typeof (ClassName) to the pageload method on the aspx page. The ClassName here is the class name of the current cs file.

(4) add [Ajax. ajaxMethod ()]. If you want to call a session, you must write it 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 input parameter is parameter.

The above Ajax client asynchronous call to the server implementation method (js call to the cs file) is all the content shared by xiaobian. I hope to give you a reference, and I hope you can also support the help house.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.