Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function login() {
- var url = "http://...";
- var username = document.getElementById("username").value;
- var password = document.getElementById("password").value;
- var xhr = new XMLHttpRequest();
- xhr.open("POST", url, true);
- xhr.setRequestHeader("Content-Type", "application/json");
- xhr.onreadystatechange = function () {
- if (this.readyState == 4 && this.status == 200) {
- alert(xhr.responseText);
- window.open(welcome);
- }
- };
- var obj = { UserName: username , Password: password }
- var data = JSON.stringify(obj);
- xhr.send(data);
- }
Add Comment
Please, Sign In to add comment