Last active
June 7, 2016 15:41
-
-
Save itsMapleLeaf/f2803de4554d1f1123bc0924aaad6dc5 to your computer and use it in GitHub Desktop.
JSON request error "invalid username"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const encode = encodeURIComponent | |
const url = "https://www.f-list.net/json/getApiTicket.php" | |
const params = `account=${encode(account)}&password=${encode(password)}` | |
const request = new XMLHttpRequest | |
request.onreadystatechange = function () { | |
if (request.readyState === XMLHttpRequest.DONE && request.status === 200) { | |
console.log(request.responseText) | |
} | |
} | |
request.open('POST', url, true) | |
request.setRequestHeader('Content-Type', 'application/x-www-url-encoded') | |
request.send(params) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment