I am trying to get a page with greasemonkey and then extract a link from it by pasting the link to the current page. I have problems with:
GM_xmlhttpRequest({
method: "GET",
url: "http://www.test.net/search.php?file=test",
onload: function(data)
{
if (!data.responseXML)
{
data.responseXML = new DOMParser().parseFromString(data.responseText, "text/xml");
}
alert("!");
var xmldata = data.response.xml;
var tests = xmldata.getElementsByTagName('test');
alert(tests[0].innerHTML);
}
});
The page is valid, and GM_xmlhttpRequest correctly returned it as a string when I tried to do this earlier, but I cannot figure out how to do this, so I can use node operations on it. Thanks in advance.
Change - the second related question
How can I link to the current page so that I can pass it to the functions, just as I would pass my loaded page? Ex
function FindTests(currentpage)
{
currentpage.getElementById('blah');
}
where I transfer the document first, but later I use the selected page. Sorry if the wording is confusing.