XMLHttpRequest validity in AJAX Development

Source: Internet
Author: User

The biggest problem facing AJAX developers is how to respond when XMLHttpRequest is unavailable.

Although most modern browsers support XMLHttpRequest, there are still a small number of users whose Browsers Do not support it or prevent XMLHttpRequest use due to browser security settings. Therefore, you should try your best to ensure that the application system is "downgraded normally", and retain the function applicable to browsers that do not support XMLHttpRequest in the system.

In the shopping Cart example, the best way is to have an Add to Cart button, which can be submitted normally and refreshed to reflect changes in the shopping Cart status. AJAX can be added to the page through JavaScript when the page is loaded. The JavaScript processing function can be added to each Add to Cart button only when XMLHttpRequest is available.

Another method is to check XMLHttpRequest during user login, and then decide whether to provide the Ajax version or the general version submitted based on form.

(

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.