. 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 删除。