-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathretest.js
31 lines (27 loc) · 1.04 KB
/
retest.js
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
//var script = document.createElement('script');
//script.src = '//code.jquery.com/jquery-1.11.0.min.js';
//document.getElementsByTagName('head')[0].appendChild(script);
//$.post("demo_test.asp", function(data, status){
// alert("Data: " + data + "\nStatus: " + status);
//
//$("button").click(function(){
// $.post("demo_test.asp", function(data, status){
// alert("Data: " + data + "\nStatus: " + status);
// });
//});
//https://stackoverflow.com/questions/1255948/post-data-in-json-format
// construct an HTTP request
//xhr.open(form.method, form.action, true);
//var xhr = require('/usr/lib/nodejs/xmlhttprequest').XMLHttpRequest;
var xhr = new XMLHttpRequest();
//var xhr = bla.XMLHttpRequest();
xhr.open("post", "/KSK/insert", true);
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
console.log("hi");
xhr.onreadystatechange = function () {
//document.write(xhr.responseText)
//console.log(xhr.responseTex)
print(xhr.responseTex);
};
// send the collected data as JSON
xhr.send(JSON.stringify(data));