Greasemonkey AJAX request from a different domain?
问题 I'm trying to get JavaScript (with Greasemonkey) to pull data from my own site to customize another site. The code I'm using is as follows: function getURL(url, func) { var xhr = new XMLHttpRequest(); xhr.open("GET", url, true); xhr.onload = function (e) { if (xhr.readyState == 4) { if (xhr.status == 200) { func(xhr.responseText, url); } else { alert(xhr.statusText, 0); } } }; xhr.onerror = function (e) { alert("getURL Error: "+ xhr.statusText); // picks up error here }; xhr.send(null); } The