Signin  Pricing  Examples  Support

Libraries > ajax.js

ajax.js - Search Live Website Code
It's like doing CTRL+F on millions of websites' source code



NerdyData is a search engine for source code. Search the source code of 200 million websites.


JAVASCRIPT FILE http://gamecomb.com/gamecomb2.0/scripts/ajax.js

Function Explorer




Libraries on gamecomb.com


jquery.js

common.js

portal.js



Explore More


jquery.rateit.js

EasyDnnSolutions_1.1.js

fxdropdown.js

dnncore.js

ajax.js
				
/**
* 2011-8-14 增加 徐文斌
* ajax提交的工具
*/
var xmlHttpRequest;


//创建XMLHttpRequest对象
function createXMLHttpRequest()
{
    try
    { 
        // Firefox, Opera 8.0+, Safari
        xmlHttpRequest = new XMLHttpRequest();
    }
    catch (e)
    { 
       // Internet Explorer 
        try
        {
            xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {               
                window.alert("浏览器不支持");
                return false;
            }
        }
    }
    return xmlHttpRequest;
} 

var callbackName;
/**
 * 发送ajax请求
 * @param {Object} url
 * @param {Object} param   参数
 * @param {Object} callback  回调函数
 */
function sendRequestPost(url, param, callback)
{ 
    createXMLHttpRequest();
    callbackName = callback;
    xmlHttpRequest.open("POST", url, true);
    xmlHttpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
    xmlHttpRequest.setRequestHeader("If-Modified-Since","0");
    xmlHttpRequest.setRequestHeader("Cache-Control","no-cache");
    xmlHttpRequest.onreadystatechange = processResponse;
    xmlHttpRequest.send(param);
} 

function processResponse()
{
    if (xmlHttpRequest.readyState == 4)
    {      
        if (xmlHttpRequest.status == 200)
        {
            var res = xmlHttpRequest.responseText;
            callbackName(res);           
        }
    }
}


A B C D E F G H I J K L M N O P Q R S T U V W X Y Z