How to get jQuery ajax calls to work from greasemonkey page events
问题 I have a GM script which inserts a link on to the page, and then adds an event listener for when its clicked. This then runs a function which contains among other things some jQuery.get calls. These calls however do not seem to fire unless I use the unsafeWindow version of jQuery. function runMyFunc() { console.log('myFunc is called'); $.get('index.php',function () { console.log('jQuery.get worked'); }); } $("#someHook").before('<a id="myLink">Link</a>'); $('#myLink').click(runMyFunc); The