Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var xhr = new XMLHttpRequest();
- //var xhr = bla.XMLHttpRequest();
- xhr.open("post", "http://127.0.0.1:8082/KSK/insert", true);
- xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
- window.console.log("hi");
- xhr.onreadystatechange = function () {
- //document.write(xhr.responseText)
- window.console.log("Entering Callback")
- window.console.log(xhr.responseText)
- //print(xhr.responseText());
- };
- window.console.log("making json data")
- var data={"message":"This is a test message",
- "ksk":"testtest12345678",
- "host":"192.168.1.2", //Optional argument. Default = "127.0.0.1"
- "port":9481}; //OPtional argument. Default = 9481
- window.console.log("Ready to send");
- // send the collected data as JSON
- xhr.send(JSON.stringify(data));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement