I'm pretty sure that the first example shows the contents returned by GM_xmlhttpRequest, but not the "ready"
jQuery/$ is not accessible directly within Greasemonkey. It's loaded inside the page(by stackoverflow.com in this case). To access functions/properties of the page you may use the unsafeWindow-object( http://wiki.greasespot.net/UnsafeWindow ):
unsafeWindow.$(document).ready(function() {
begin();
});
But I would suggest to call begin() directly, you don't need $.ready()
here, because GM-scripts will always execute when the DOMContentLoaded-event fires, which is equal to $.ready()