ajax提交的javascript代码
var xhr=xhr(); function xhr(){ if(window.XMLHttpRequest){ return window.XMLHttpRequest(); }else if(window.ActiveXObject){ return new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){ try{ return new ActiveXObject("Msxml2.XMLHTTP"); }catch (ex){} } } } xhr.open("get","url","true"); xhr.onreadystatechange=function(){ if(xhr.readyState==4&&(xhr.status==200||xhr.status==304)){ document.getElementById("myDiv").innerHTML=xhr.responseText; } } xhr.send(); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |