Pay attention to the quotation marks when using AJAX, otherwise IE6 will not easily accept your request

Source: Internet
Author: User

In the current Process Orchestration framework, some businesses need to use ajax technology for asynchronous communication. This business mainly adds an extended page of business functions on the Puyuan activity attribute page, this is a very detailed explanation of the API of the General Yuan operation. I will not introduce it much here. Here I will mainly discuss the problems encountered in this operation.
 
Because ajax is needed to save business functions asynchronously, we know that the core of ajax is

XMLHttpRequest. To use this core object, we need to create this object. The creation of this object is browser-specific, mainly in IE browser. This problem is also caused by IE browser.
 
The code for creating the xmlHttpRequest object should be as follows:
 
[Javascript]
Function createXMLHttpRequest (){
 
// Indicates that the current browser is not ie, such as ns or firefox
 
If (window. XMLHttpRequest ){
 
XmlHttp = newXMLHttpRequest ();
 
} Elseif (window. ActiveXObject ){
 
Try {
 
XmlHttp = newActiveXObject ("Msxml2.XMLHTTP ");
 
} Catch (e ){
 
Try {
 
XmlHttp = newActiveXObject ("Microsoft. XMLHTTP ");
 
} Catch (e ){
 
Alert ("your browser does not support ajax !");
 
}
 
}
 

 
}
 
}
 
If it is not the IE browser, you can simply create a new one, but if it is the IE browser, it will be divided into the situation. If it is 6.0 +, the second method is used, that is, msxml2, if it is 5.5 +, microsoft is used.
 
However, at present, we usually use ie6.0 or above for development. Therefore, if we often write, we can directly use Microsoft to create the one in the middle.
 
However, the problem we encountered was that xmlHttp = new ActiveXObject ("Microsoft. XMLHTTP "); xmlHttp = new ActiveXObject (Microsoft. XMLHTTP); this way in other browsers are successfully executed, but on IE there is a problem, and the IE7-9 is no problem, only IE6 problems, because the client to deploy, the customer uses IE6, which is always unsuccessful because the quotation marks are missing due to negligence. Detected because quotation marks are missing. Temporary negligence will waste a long time debugging.
 
So I wrote this blog and shared it with you. I hope you will pay attention to such issues in the future.

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.