forked from jrk/ProwlIt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprowl.js
27 lines (24 loc) · 1011 Bytes
/
prowl.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
// Method from http://www.openjs.com/articles/ajax_xmlhttp_using_post.php
var http = new XMLHttpRequest();
var url = "https://prowl.weks.net/publicapi/add";
var apikey = "XXXX";
var application = "the web";
var evt = "Browser!";
var description = encodeURIComponent(document.title.replace(/^\s*|\s*$/g,''))
+ escape("\n") + encodeURIComponent(location.href);
var params = "apikey="+apikey
+"&application="+escape(application)
+"&event="+escape(evt)
+"&description="+description
;
http.open("POST", url, true);
//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
//http.setRequestHeader("Content-length", params.length);
//http.setRequestHeader("Connection", "close");
//http.onreadystatechange = function() {//Call a function when the state changes.
// if(http.readyState == 4 && http.status == 200) {
// alert(http.responseText);
// }
//}
http.send(params);