码迷,mamicode.com
首页 > Web开发 > 详细

原生JS的HTTP请求

时间:2017-05-11 20:28:28      阅读:288      评论:0      收藏:0      [点我收藏+]

标签:run   html   end   request   amp   off   ice   cti   font   

ar xhr = new XMLHttpRequest();

        xhr.onreadystatechange = function(){

 

            if( xhr.readyState == 4){

 

                if( xhr.status >= 200 && xhr.status < 300 || xhr.status == 304){

 

                    info.innerHTML = xhr.responseText;

                }

            }

        };

        xhr.open("get","test.txt",true);

        xhr.send(null);

原生JS的HTTP请求

标签:run   html   end   request   amp   off   ice   cti   font   

原文地址:http://www.cnblogs.com/pms01/p/6842403.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!