I am trying to run this in Chrome/Firefox Console but not having any luck.
(function(d) {
var form = d.getElementsByTagName('form');
var i = form.length;
while (i--) {
form[i].addEventListener("submit", function(evt){
evt.preventDefault();
}, false);
xhr = new XMLHttpRequest();
xhr.open("POST", "http://example.com/", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("media_id=" + form[i].elements["media_id"].value);
}
})(this.document);
Can anyone spot any problems with it? Thanks
EDIT: I have fixed the problem. Thanks @Niklas