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) {// sets the 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 );
}
}
}
}