Typo: paramter
xmlhttpRequest works only on same domain I think.
Are you pushing your script in a page from example.com?
For reference, the code indented and as a code block:
var id1 = document.getElementsByName("ID1")[0].value
var id2 = document.getElementsByName("ID2")[0].value
GM_xmlhttpRequest({
method: "POST",
url: "https://www.example.com/",
data: 'paramter1=' + id1 '¶mter2=' + id2,
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
onload: function(response) {
console.log("gut response");
$("#input").get()[0].value = response.responseText;
}
});
I assume you don't see any obvious errors in the console?
Try adding an onerror handler to see whether you get any insight that way.
Greasemoneky GM_xmlhttpRequest POST
I am trying to create a script that will send a POST requests immediately after loading the web page .
The POST data parameter will contain certain values that it will collect from element in responseHTML via "document.getElementsByName"
here is what i am doing but it isnt working ---
var id1 = document.getElementsByName("ID1")[0].value
var id2 = document.getElementsByName("ID2")[0].value
GM_xmlhttpRequest({method: "POST",
url: "https://www.example.com/",
data: 'paramter1=' + id1 '¶mter2=' + id2 ,
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
onload: function(response) {
console.log ("gut response");
$("#input").get()[0].value=response.responseText;
}
});