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.
(