Get the App
SLTechnology News&Howtos  ›  Development  › 

How does DOM run in AJAX?

Shulou Source: shulou.com Published: 2022-06-03 07:46:44 10月03日 Update

This article will explain in detail how DOM runs in AJAX. The quality of the article is high, so Xiaobian shares it with you as a reference. I hope you have a certain understanding of related knowledge after reading this article.

DOM was AJAX operation depressed for several days, today finally figured out, self-study is bitter ah, bitter a nose a tear,

The lesson out, to remind the latecomers, old birds do not see.

1. Do not confuse the XML operations in DOM with those in the browser. For example, getElementByName is a DOM operation built into the document object in the browser, which you use to operate.

ResponseXML is the wrong one. In the browser, you can use document.getElementsByName ('tagname ')[0].value to get the control value, but in the operation

For responseXML you must use getElementsByName ('tagname ')[0]. firstChild.data (same as nodeValue).

2. If you want to apply responseXML, you write response.setContentType("text/xml") in the server's response service;

If your AJAX code doesn't go through once, then even after you change it correctly, the page may still be wrong. This is caused by the pesky browser cache,

Damn cache. I've been stuck on this for at least a whole day.

So you'd better write a cache disallowed statement response.setHeader("Cache-Control","no-cache") on the server response page;

(The request url followed by the number of milliseconds of the current system is also a method.) Use new Date().getTime() in js to get the millisecond difference between the system and a specific time.).

3. Because some of the current IE standards are not fully compliant with W3C. For example:

We all know about onchange events, but IE does not support onchange attributes for text controls. Fortunately, we

onpropertychange event to listen for text.

For example, we can use setAtribute () to set CSS properties in browsers other than IE, but it is not supported in IE. Similarly, we use

EObj.style.stylearrtibute=value.

About AJAX DOM operation is how to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.

Tags: Browsers browsing controls caching services runs events content that is properties articles servers knowledge articles systems errors pages support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Information MySQL macOS Redmi