Deferred passes the XHR object to it's callback function. Is there a  
way to get a reference to the Deferred in the callback?

What I'm trying to do is to transport some vars in the Deferred and  
use them in the callback.

Let's say I wanted to load a specific URL into a part of the DOM.  
Usually I hard code the DOM element into which to place the results.  
But what if I wanted to make that more dynamic?

E.g. I have:

show_detail =  function(rec_id)
{
     var url='/admin/'+controller+'/ajax_info/'+rec_id+'
     var d = doSimpleXMLHttpRequest(url);
     d.addCallback(function (req) {
         $('data_preview').innerHTML = req.responseText; // hardcoded  
to data_preview
     });
}

Assume that I wanted to make data_preview dynamic - e.g. pass it as a  
parameter to the show_detail function.

I was contemplating setting it as a property on the deferred object  
and then retrieving it in the callback. I suppose, I could also  
attach it to the req, but I didn't find a way to get at that from the  
deferred either.

Either approach seems a little hacky. There's probably a better way.  
But I can't see it.

Any suggestions?

Thanks,
Juergen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" 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/mochikit
-~----------~----~----~----~------~----~------~--~---

Reply via email to