Build a reliable AJAX application, part 2nd: Building Ajax back-end

Source: Internet
Author: User

Introduction: Back-end processing-server-side scripts and programs-does not always work well in an Ajax application. Conversely, careful planning in advance to ensure that data is sent in a proper and efficient format can make the entire application more cohesive and reduce unnecessary complexity. In this article, Brett McLaughlin shows how a good server-side script can complement Ajax behavior.

In the 1th part of this series, we built a visually rich front-end to showcase the picture library based on the Hoverbox Code of Nathan Smith (which links to the initial Hoverbox code can be found in the Resources section). With this process, you learned some basic UI principles: the z-mode of the human eye, how to keep the page consistent, how to reduce the font size of the text in the box from the page slide, and the difference between the readability of the serif and Sans-serif fonts.

After you finish the 1th part, you should have a decent picture library, as shown in Figure 1, which is the Hoverbox UI we finished in part 1th:

Figure 1. Hoverbox UI completed in part 1th

In this article, we will add key backend processing and some Ajax-specific code to connect the picture library to the back end.

Get ready for the Ajax piping process.

As I mentioned earlier, most of the work of Ajax is pipeline processing: Setting up XMLHttpRequest objects, invoking server-side programs, and getting responses. The program may change, and the details of the request may vary, but in any case the basic settings are the same:

Create a new Request object (preferably in a cross-browser manner).

Constructs a request URL and may also POST request data.

Sets a method that uses this method to recall a browser when a response is received from the server.

Send the request.

Constructs a callback that can run and execute any action that the program wants to do with the server data.

More details can be found in other articles (see the Resources section), so we'll just give you a ballpark figure.

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.