On 17/01/2010 19:53, Brian L. Matthews wrote:

The post() function contains the GM_xmlhttpRequest() function, and (I assume) GM_xmlhttpRequest() returns the target page, but it doesn't store or return the data returned by GM_xmlhttpRequest().

You have this:

function post(url, data, cb) {
  GM_xmlhttpRequest({...});
}


I think you want this:

function post(url, data, cb) {
  return GM_xmlhttpRequest({...});
}

I could be wrong, but I think an asynchronous GM_xmlhttpRequest always returns undefined, and a synchronous request always returns the response object. The return from the callbacks is ignored, so a return in one of the callbacks is pointless. If you want the callback to do something with the data it gets, you have do something explicit with it, which is usually add it to the page somehow.

Brian

I think you're right - I forgot about synchronous vs. asynchronous (It's been a while since I used an xmlhttprequest) It's the onload: function defined within the command that is executed on completion of the command, right? So that code needs to specify what to do with responseText (add it to the page, or call another function to process it).
-- 
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