我是靠谱客的博主 繁荣方盒,这篇文章主要介绍利用浏览器控制台进行网络请求,现在分享给大家,希望可以做个参考。

var url = "http://127.0.0.1:8080/open/test";
var params = {
    "ids": [11]
};
var xhr = new XMLHttpRequest();
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onload = function(e) {
    if (xhr.readyState === 4) {
        if (xhr.status === 200) {
            console.log(xhr.responseText);
        } else {
            console.error(xhr.statusText);
        }
    }
};
xhr.onerror = function(e) {
    console.error(xhr.statusText);
};
xhr.send(JSON.stringify(params));

最后

以上就是繁荣方盒最近收集整理的关于利用浏览器控制台进行网络请求的全部内容,更多相关利用浏览器控制台进行网络请求内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(122)

评论列表共有 0 条评论

立即
投稿
返回
顶部