The use of Ajax records in JS

Source: Internet
Author: User

Last month in the invoicing software, using a lot of the need to get data asynchronously, today is over, hereby recorded

The overall feeling JS made out than jquery, convenient a lot (also may be I use less), but the compatibility aspect really cannot compare with jquery

In addition to the use of jquery during the discovery of a POST request for ASP, there will be a failure of the request, but to get after it can be, so I am quite depressed, which is later I did not choose Jquey to do a step request for a big reason

Here I use asynchronous operations to handle messages that need to be pushed to iOS

var http1;

The browser is used here to determine
if (window. XMLHttpRequest) {
HTTP1 = new XMLHttpRequest ();
}
else {
HTTP1 = new ActiveXObject ("Microsoft.XMLHTTP");
}
Http1.onreadystatechange = function () {
if (http1.readystate = = 4 && http1.status = = 200) {

The output data is obtained here
Flag1 = Http1.responsetext;
alert (FLAG1);
}
}
Http1.open ("POST", "Tools/getptoken.ashx", true);
Http1.setrequestheader ("Content-type", "application/x-www-form-urlencoded");
Http1.send ("type=2&biaoti=" + document.getElementById (' <%=biaoti. ClientID%> '). Value + "&fubiaoti=" + document.getElementById (' <%=fubiaoti. ClientID%> '). Value + "&content=" + editor.text ());

The use of Ajax records in JS

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.