Hi, I'm looking for a way to wait for an ajax request to complete before returning something. I know about the (a)synchronous options, but I don't want to go synchronous, since that makes the browser unresponsive while waiting.
I also know about using callbacks. I use this currently but it kind of obfuscates my code. object A needs some data(a name for example) from object B, but B needs to get some stuff (json) from the server to give back the correct answer to A. At the moment I need object A to tell object B "I need your name, call my 'iveGotANameForYou' - method when you have it. Now, object A can ask for lots of different stuff(not just names), on all kinds of objects, so it has lots and lots of callback-methods for all different kinds of answers. While I like this event-driven approach, it feels like a bit of overkill to me. I would rather have the possibility for object B to defer returning the answer to object A until it's fetched from the server. That way I can just ask type "var bName = objectB.name()" in objectA without having to write callbacks for every kind of answer. Has anyone found a way around this problem? What I need is a way to 'lock' just one thread instead of locking up the whole application. Are there any libraries devoted to this? Any other thoughts? Thanks, Mathijs --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
