Login   Register  
PHP Classes
elePHPant
Icontem

File: jAPI.js

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Vladica Savic  >  jAPI Direct  >  jAPI.js  >  Download  
File: jAPI.js
Role: Auxiliary data
Content type: text/plain
Description: jAPI JavaScript
Class: jAPI Direct
Handle calls of JavaScript to PHP code
Author: By
Last change: Removed jQuery Ajax
Date: 4 years ago
Size: 1,319 bytes
 

Contents

Class file image Download
    function jAPIRemote(scriptURL, params)
    {
        var xmlHttp;
        try
        {
            // Firefox, Opera 8.0+, Safari and other "NORMAL" browsers
            xmlHttp=new XMLHttpRequest();
        }
        catch (e)
        {
            // IE ( (Imbecil Engine (Internet Explorer))
            try
            {
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e)
            {
                try
                {
                    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e)
                {
                    alert("Your browser does't support AJAX!");
                    return false;
                }
            }
        }
           
            xmlHttp.open('POST',scriptURL,false);
            xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            xmlHttp.setRequestHeader("Content-length", params.length);
            xmlHttp.setRequestHeader("Connection","close");
            xmlHttp.send(params);

            if(xmlHttp.status == 200)
            {
                return xmlHttp.responseText;
            }
            else
            {
                return "Some error occurred!";
            }
    }