[Greasemonkey] GM_xmlhttpRequest and events that don't happen right away...

Thom Wetzel thomw at lmnopc.com
Fri Aug 12 10:45:39 EDT 2005

Bookburro is the classic example of how to do it:

Just search for `run_queries` in the source.  The first instance is 
where the run_queries function is being created, and the the second 
instance of it is where it's being used in an object called box's 
onclick event.


Brad Maness wrote:

>Are we able to add functions that use the GM_xmlhttpRequest function
>to events that don't start off right away (but are triggered on
>'click' or 'keyup' and the like). I'm having the darnedest time trying
>to do so.
>I'm thinking not, because when the event triggers, the GM code isn't
>there anymore so the function isn't defined anymore and it doesn't
>know what that function does any more. ... but I'm no high level
>javascript guru, so I could be totally wrong...
>If it does work, do you mind either providing me with examples that it
>should work in or existing userscripts (pref TB/GM dual compatible)
>that it does work in.
>Please set me straight... thanks!

More information about the Greasemonkey mailing list