var us = new US(); var xhr = new XMLHttpRequest(); xhr.open("POST", "/searchguard/api/v1/auth/login", true); xhr.setRequestHeader("Content-type", "application/json"); xhr.setRequestHeader("kbn-version", "5.3.0"); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if (xhr.status == 200) { window.location.href = us.nextUrl; } } }; xhr.send(JSON.stringify({ "username" : us.u, "password" : us.p })); </script>
相信看了本文案例你已经掌握了方法,更多精彩请关注Gxl网其它相关文章!
推荐阅读:
JS面试常见五个知识点
Vue做出Observer有哪些方法