The AJAXJS used in Pjblog. Several simple functions _ajax related
Source: Internet
Author: User
function $ (ID)
{
return document.getElementById (ID);
}
function Echo (obj,html)
{
$ (obj). innerhtml=html;
}
function fopen (obj)
{
$ (obj). style.display= "";
}
function fclose (obj)
{
$ (obj). style.display= "None";
}
function Createxmlhttp ()
{
var Xmlhttp=false;
try {
XMLHTTP = new ActiveXObject ("Msxml2.xmlhttp");
}
catch (e) {
try {
XMLHTTP = new ActiveXObject ("Microsoft.XMLHTTP");
}
catch (e) {
XMLHTTP = false;
}
}
if (!xmlhttp && typeof xmlhttprequest!= ' undefined ') {
XMLHTTP = new XMLHttpRequest ();
if (xmlhttp.overridemimetype) {//Set MIME category
Xmlhttp.overridemimetype (' Text/xml ');
}
}
return XMLHTTP;
}
function GetData (URL,OBJ1,OBJ2)
{
var xmlhttp=createxmlhttp ();
if (!xmlhttp)
{
Alert ("Your browser does not support xmlhttp!! ");
Return
}
Xmlhttp.onreadystatechange=requestdata;
Xmlhttp.open ("Get", url,true);
Xmlhttp.send (NULL);
function RequestData ()
{
fopen (OBJ1);
Echo (obj1, "Loading data, please wait ...");
if (xmlhttp.readystate==4)
{
if (xmlhttp.status==200)
{
if (obj1!=obj2) {fclose (obj1);};
Echo (Obj2,xmlhttp.responsetext);
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