用jquery发送get请求
function AjaxSubmit1() {
        $.ajax({
            //用jQuery发送
            url: '/app04/ajax1/',
            type: 'GET',
            data: {'p':123},
            success:function () {

            }
        })
    }

原生发送get请求
function AjaxSubmit2() {
        //原生发送请求
            var xhr = new XMLHttpRequest();
            xhr.onreadystatechange = function () {
                if (xhr.readyState == 4) {
                    // 接收完毕服务器返回的数据
                    console.log(xhr.responseText);

                }
            };
            xhr.open('GET', '/app04/ajax1?p=123');
            xhr.send(null);
        }

 

posted on 2018-06-19 15:07  wy0925  阅读(176)  评论(0)    收藏  举报