Ajax框架

function ajax(url, fnSucc, fnFaild){
var oAjax = null;
if(XMLHttpRequest)
{
oAjax = new XMLHttpRequest();
}
else
{
oAjax = ActiveXObject("Microsoft.XMLHTTP");
}
oAjax.open('Get',url,true);
oAjax.send();
oAjax.onreadystatechange = function(){
if(oAjax.readyState == 4)
{
if(oAjax.status == 200)
{
fnSucc(oAjax.responseText);
}
else
{
if(fnFaild)
{
fnFaild();
}
}
}
};
};


你可能感兴趣的:(javascript)