var?xmlhttp;????
??if?(str=="")
??{
????document.getElementById("txtHint").innerHTML="";
????return;
??}
??if?(window.XMLHttpRequest)
??{
????//?IE7+,?Firefox,?Chrome,?Opera,?Safari?瀏覽器執(zhí)行代碼
????xmlhttp=new?XMLHttpRequest();
??}
??else
??{
????//?IE6,?IE5?瀏覽器執(zhí)行代碼
????xmlhttp=new?ActiveXObject("Microsoft.XMLHTTP");
??}
??xmlhttp.onreadystatechange=function()
??{
????if?(xmlhttp.readyState==4?&&?xmlhttp.status==200)
????{
??????document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
????}
??}
??xmlhttp.open("GET","/try/ajax/xxx"+str,true);
??xmlhttp.send();
ng的http模塊是把上述封裝后的實(shí)現(xiàn)。順便說下你不知道原生沒必要這么早看angular,react這種吧?