Why this simple Greasemonkey script is not working for me https://jsfiddle.net/pghnsw8z/1/ ? I mean that instead of getting successful response I get error while making an ajax call.
// ==UserScript==
// @name _Starter AJAX request in GM, TM, etc.
// @match *://php.net/*
// @grant GM_xmlhttpRequest
// @connect php.net
// ==/UserScript==
GM_xmlhttpRequest ( {
method: 'GET',
url: 'http://php.net/',
onload: function (responseDetails) {
// DO ALL RESPONSE PROCESSING HERE...
alert(responseDetails);
console.log (
"GM_xmlhttpRequest() response is:\n",
responseDetails.responseText.substring (0, 80) + '...'
);
}
} );
I found the script here https://mcmap.net/q/752486/-how-can-userscript-make-a-network-request-to-a-different-domain and it seems it worked well for someone earlier.
I'm using Firefox 59.0.1 and Greasemonkey 4.3
Restarting Firefox and reinstalling script didn't help.
GM.xmlhttpRequest is not a function
– Angelinaangeline