When are you verifying its value, it will be undefined until the ajax request has come back to the onSuccess handler.
-- Matt Foster Ajax Engineer Nth Penguin, LLC http://www.nthpenguin.com On Jun 26, 7:47 am, kangax <[EMAIL PROTECTED]> wrote: > That should actually work unless there's another "globalObject" in the > scope of callback function. Are you sure a proper response comes from > the server? > > - kangax > > On Jun 26, 3:25 am, Namotco <[EMAIL PROTECTED]> wrote: > > > I want to have a global object that can be updated via Ajax: > > > var globalObject; > > > function updateObject (id) { > > new Ajax.Request('url', { parameters: {id: id}, onSuccess: > > function(transport) { > > globalObject = transport.responseText.evalJSON(); > > > }}); > > } > > > That never seems to work though, why not? > > > Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---