I created a basic script for Greasemonkey in order to search for the word test
on Stack Overflow.
According to GM_xmlhttpRequest
documentation, parameters for the request should be indicated in the data
argument.
// ==UserScript==
// @name Test Search SO
// @namespace Test Search SO
// @description Test Search SO
// @include http://YOUR_SERVER.COM/YOUR_PATH/*
// @version 1
// @grant GM_xmlhttpRequest
// ==/UserScript==
alert("Ready?");
GM_xmlhttpRequest({
url: "http://stackoverflow.com/search",
method: "GET",
data: "q=test",
onload: function(response) {
document.getElementsByTagName("html")[0].innerHTML = response.responseText;
alert("Done.");
}
});
Unfortunately, the result is just the page http://stackoverflow.com/search
like if data
was ignored.
How can I fix this, please?