Introduced
This article describes an easy way to write Web applications using AJAX and ASP.net. At the same time, the advantages and disadvantages of using Ajax are discussed. For illustrative purposes, this article gives the corresponding JavaScript code and uses C #. NET writes the ASP.net code.
Why use Ajax
Perhaps most people already know that Ajax means asynchronous JavaScript and XML (asynchronous JavaScript and XML). As far as I know, this technology was originally presented by Microsoft in 1999, which is known as the "Dhtml/javascript Web application using remote invocation (calls)." The core of this technology is to send an asynchronous HTTP request through the browser to invoke the server's Web page or service, and after the result is returned, the entire page can be updated without refreshing. This technology is constantly being perfected, and to this end, Web programs using Ajax are behaving much like Windows programs.
Because the implementation of this technology needs to rely on the front-end browser, it is limited in its use. But in recent years, thanks to the enhancement of browser capabilities and the performance of many AJAX-based applications such as Google and Amazon.com, the technology has finally made the Phoenix Nirvana and horny.
Ajax is now used very widely, and any dynamic Web page with a rich user experience will invariably use Ajax.
Solution
The method of using Ajax described in this article is very simple and efficient. This approach is also very easy to maintain, and developers can implement it without any special skills, and can also be used across browsers in this way.
A basic AJAX implementation requires two main parts: a client-side HTML page written in JavaScript code that sends requests and receives responses to the server, and a remote page that can receive requests and send response information to clients. The task of the client's JavaScript code is to create a XMLHTTP object, then send the request information to the server and finally handle the response information returned by the server by way of a callback. All of this is done by JavaScript code.
The example of this article uses ASP.net program implementation, in the implementation of the following points:
1. Ajax can send requests to different service-side pages on different asp.net pages.
2. The remote page URL can contain dynamically computable parameters, which makes it easier to create a URL string in the asp.net back-end code.
3. A remote page can respond with complex data before updating an HTML page, which can also be done by asp.net back-end code.
4. A server-side page can be an extended third party page, or it can be a Web page or service of its own.
The above points are shown in Figure 1
Figure 1