Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fetch('/api/v1/auth', {
- method: 'POST',
- headers: {
- 'cache-control': 'no-cache',
- 'content-type': 'application/x-www-form-urlencoded',
- },
- body: {
- username: "user",
- password: "pass"
- }
- })
- var data = "username=test123&password=test123";
- var xhr = new XMLHttpRequest();
- xhr.open("POST", "/api/v1/auth");
- xhr.setRequestHeader("cache-control", "no-cache");
- xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");
- xhr.send(data);
- xhr.addEventListener("readystatechange", function () {
- if (this.readyState === 4) {
- console.log(this.responseText);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement