标签:style blog http io color os ar sp div
//地址 成功方法 失败方法
function Ajax(url, funsucc, funfial) { var oAjax = null; if (window.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) { funsucc(oAjax.responseText);//将返回的TEXT放到成功方法中 } else { if (funfial) {//如果传了失败的方法,则执行 funfial(); } } } } }
标签:style blog http io color os ar sp div
原文地址:http://www.cnblogs.com/juexin/p/4055209.html