原声JS网络请求

 //创建xhr对象
            var xhr = new XMLHttpRequest();
            //异步接受响应
            xhr.onreadystatechange = function () {
                if (xhr.readyState == 4) {
                    if (xhr.status == 200) {
                        //实际操作
                        // alert(xhr.responseText);
                        $("#Container").html(xhr.responseText);
                    }
                }
            }
            //发送请求
            xhr.open('post', '/Role/TeaManagePageView', true);
            xhr.send({ Page: 1 });

posted @ 2018-10-30 14:55  向往的人生  阅读(1280)  评论(0编辑  收藏  举报