Good afternoon everyone!

I've noticed a really weird behavior of GM_xmlhttpRequest.  It seems
like the process is async, instead of sync.  I have a list of links I
want to retrieve via GM_xmlhttpRequest.

here's the code:

for (var i = 0; i < links.length; i++) {
     GM_log('inspecting item: ' + i);
     var p = links[i];
     GM_log('href: ' + p.getAttribute('href'));

     GM_xmlhttpRequest({
          method:'GET',
          url:p.getAttribute('href'),
          onload: function(r) {
               GM_log(i + ': contacting ' + p.getAttribute('href'));
               GM_log(i + ': connection status: ' + r.status);
               if (r.status == 200) {
                    GM_log(i + ': site returned ' +
r.responseText.length + ' characters.');
                    p.style.color = 'green';
               }
          }
     });
}

The weird thing is that the GM_xmlhttpRequest only looks at the last
link.  Is this a bug or a feature by design?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.

Reply via email to