[Greasemonkey] GM_xmlHttpRequest question
Jossie Mann
jossie at starbug.org
Fri Jul 28 14:20:11 EDT 2006
I'm creating some new html tags. I'm trying to have greasemonkey parse
html pages I create, and whenever it encounters one of these html tags,
I want to send out a GM_xmlHttpRequest. Now I've been able to
accomplish all of that. However here's where my problem occurs, when
the data comes back from the server, I want the content that the server
returns injected into the page where the html tag is located. My
problem is, how can I store the association between the html tag and the
xmlHttpRequest so that when the xmlHttpRequest returns back to the page
I know which html tag triggered it.
Initially I only had one html tag per page, so I was just able to store
that one tag in a global variable. However, after I added multiple tags
this didn't work as the xmlHttpRequests could return in a different
order from the page's order.
Second I tried to do a for loop through all the html tags, and set an
onload event for each html tag. However, this didn't work. The first
html tags onload would occur, but that caused the greasemonkey script to
stop running and none of the other onloads to even get created.
Is it possible to do what I'm attempting to accomplish through
javascript and greasemonkey?
Thanks, Jossie
More information about the Greasemonkey
mailing list