chrome控制台发送post请求
作者:互联网
chrome控制台发送post请求
chrome, 按F12,打开控制台, 执行下面脚本
代码
var url = "https://www.test.com/Admin/testpost; var params = {id:"1",name:"q"}; 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));
参考:https://www.cnblogs.com/barrysgy/p/15696559.html
标签:www,console,chrome,xhr,var,post,控制台 来源: https://www.cnblogs.com/pu369/p/16627697.html