On Sun, Sep 21, 2008 at 7:38 AM, Amit Dhingra <[EMAIL PROTECTED]> wrote: > Hi, > I am trying to access PHP from my GWT code, where I access the database and > form JSON of the data, which is send back to the GWT.
It sounds like you are saying that you want to get an asynchronous response back from some server that happens to be running PHP and happens to be accessing some database. > For the following code GWT code > private SampleEventCacheController eventCache = new > SampleEventCacheController(); // I access PHP from this constructor > > private MultiView multiPanel = new MultiView(eventCache, new > DefaultStringPanelRenderer()); > > Now in the MultiView constructor, I tend to access the HashMap which must > have been filled by the JSON data. I expect that the JSON data will be > filled before the MultiView constructor gets called, but this is not what is > happening. The call to the function which populates the HashMap cames way > later when the MultiView constructor is done. Seems to me you are thinking calls to the server happen synchronously, and I'm guessing your call to the server is happening asynchronously. And, I'm not sure eventCache can ever contain the response value from an asynchronous call. Look at RequestBuilder. There are two callback methods that are called when a response is returned from the server. You will need to chain your actions, that rely on the returned data, from the callback. Does that make sense? -- Jim Freeze --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" 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/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
