AJAX Create and send data

Source: Internet
Author: User

<script type= "Text/javascript" >
Create Ajax
function Initxmlhttp ()
{
var xmlhttp
try {
Xmlhttp=new ActiveXObject ("msxml2.xmlhttp");
catch (e) {
try {
Xmlhttp=new ActiveXObject ("Microsoft.XMLHTTP");
catch (E) {
Xmlhttp=false;
}
}
if (!xmlhttp && typeof xmlhttprequest!= ' undefined ') {
try {
XMLHTTP = new XMLHttpRequest ();
catch (e) {
Xmlhttp=false;
}
}
if (!xmlhttp && window.createrequest) {
try {
XMLHTTP = Window.createrequest ();
catch (e) {
Xmlhttp=false;
}
}
return XMLHTTP;
}
Show
PType Column ID
Liclass node Identification ID
ID Bar ID
VC node points
function Drawselect (PTYPE,LICLASS,ID,VC) {

element = document.getElementById ("S_" + VC);//Get the next node position
var xmlhttp=initxmlhttp ();
var url= "type.php?act=selectx&ptype=" + ptype + "&liclass=" + Liclass + "&id=" + ID + "&vc=" + VC;
Xmlhttp.open ("Get", url,true);/Asynchronous transfer
Xmlhttp.open ("Get", url,false)//synchronous transmission for all levels
Xmlhttp.onreadystatechange=function () {
if (xmlhttp.readystate==4 && xmlhttp.status==200) {
Element.innerhtml=xmlhttp.responsetext;
}
}
Xmlhttp.send (NULL); Start running

}

Related Article

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.