首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >【流程测试】Chrome浏览器如何模拟发起post请求

【流程测试】Chrome浏览器如何模拟发起post请求

原创
作者头像
好派笔记
修改于 2021-10-08 14:51:31
修改于 2021-10-08 14:51:31
6.8K0
举报
文章被收录于专栏:好派笔记好派笔记

. var url = "http://192.168.1.217:8080/tasksupervise/common/api/userlogin";

. var params = {loginName: 'admin', password: "XXXX"};

. 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));

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档