Step 1 to solve the IE encoding problem:
DataType :( $. browser. msie )? "Text": "xml" first, let IE identify whether text or xml is returned.
Step 2:
Copy codeThe Code is as follows:
Function parseXml (xml) {// xml ie encoding problem Step 2
If (jQuery. browser. msie) {// determines if the browser is IE
Var xmlDoc = new ActiveXObject ("Microsoft. XMLDOM"); // xmldom object under Microsoft
XmlDoc. loadXML (xml );
Xml = xmlDoc;
}
Return xml;
}
Step 3:
Copy codeThe Code is as follows:
Function getText (xml)
{Var newXML = parseXml (xml );
Var sp = $ ("# special ");
Var manage = $ ("# manageContent ");
Var common = $ ("# common ");
..... Omitted
}
It has been applied in ongoing projects and therefore is promoted ..
Why is it that IE is invalid? From the above solution, we can know that it is an XML file encoding problem. XML objects that do not comply with IE are not readable at the front-end during conversion, therefore, it must be translated into IE-compatible objects.