On 8/23/06, fimi <[EMAIL PROTECTED]> wrote: > > I have different objects that i'll be using and each of those objects > needs to make requests to the server to get it's data. > > So let's ay in objectA i create a new variable(newB) of objectB, then > objectB will get it's data and initialize itself then if i want the new > variable to get me those data right after i issue newB.getResult. > > in this example, i get the following result: > INFO: ObjectA.getObjectB: i will create a object B and call getB. > INFO: ObjectB.getB will request to get Data and parse it as JSONDoc > INFO: ObjectA.getObjectB finished, i should have data: > INFO: ObjectB.handleB data, JSON return is: [object Object] > > 3 AND 4 should be switched...
Your explanation doesn't make any sense to me, but the code is broken. Your problem is that you're trying to write sequential code but you need to be writing asynchronous code. You can't get the result of a network event until after it has occurred, so nomatter how you write it you're going to need to use a callback. Adding an extra object and four function calls doesn't in any way change that, you're still going to need to use a callback to get at that data. -bob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
