Differences between Ajax and callback

Source: Internet
Author: User
Differences between Ajax and callback

The content on this page is: the difference between Ajax and callback.ArticleThis site is reposted from the network. If any infringement occurs, we will delete it in time. The body of the content is as follows:

AJAX can call back the server method on the client, or callback. The difference between Ajax and callback lies in the following two points:
I. Callback can only return the string type, while AJAX can return other types, such as dataset, or the type you define.
II. Ajax logic is simpler than callbcak,
Callback is divided into the following steps:
1) register the client script on the server
String callbackref = page. clientscript. getcallbackeventreference (this, "Param", "handleresultfromserver", "context ");
// Handleresultfromserver is the function name of the client function returned by the server after processing.
String callbackscript = "function calltheserver (Param, context)" + "{" + callbackref + "};";
Page. clientscript. registerclientscriptblock (this. GetType (), "calltheserver", callbackscript, true );
2) The client calls the calltheserver function to pass parameters to the server.
3) receive and process parameters on the server
4) The server returns the string type parameter to the client.
5) The client receives and processes parameters.
Ajax is divided into the following steps:
1) register the client script on the server
Ajax. Utility. registertypeforajax (typeof (pageclass); // pageclass is the class name of the page.

Alternatively, you can manually add the script on the client:


2) The client directly calls the server method (but there is one more parameter than the method, is the function name of the client function that the server returns the parameter to after processing)
3) The server method returns the object to the client
4) the client receives and processes
Ajax is more convenient, especially when several callbacks need to be processed on a page.

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.