-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSo.html
36 lines (36 loc) · 1.31 KB
/
So.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<html>
<head></head>
<body>
<textarea></textarea>
<input id="url" placeholder="url"/>
<input id="method" placeholder="method"/>
<input type="checkbox" id="isdata" />
<input id="data" placeholder="Data"/>
<button onclick="loadPage()">Load</button>
<input id="header" placeholder="content type"/>
<!--<div style='display:none'></div>
<div class="username"></div>//-->
</body>
<script>
function loadPage(){
var url = document.getElementById('url').value,
method = document.getElementById('method').value,
isdata = document.getElementById('isdata').checked,
data = document.getElementById('data').value,
header = document.getElementById('header').value;
var x = new XMLHttpRequest();
x.open(method,url,true);
x.withCredentials = true;
if(method == 'post')
x.setRequestHeader('Content-type',header);
x.onreadystatechange = function(){
if(x.readyState ==4)
document.getElementsByTagName('textarea')[0].value = x.responseText;
//document.getElementsByTagName('div')[0].innerHTML = x.responseText;
//username = document.getElementsByClassName('-cx-PRIVATE-NavBar__username__')[0].innerHTML;
//document.getElementsByClassName('username')[0].innerHTML = "You are logged in as "+username;
};
isdata?x.send(data):x.send();
}
</script>
</html>