I'm trying to either return a value or set a global variable from
within a function run on the onSuccess event.  I've tried defining an
inline function and setting a global variable, returning a value, and
even defining a separate function that gets called.  The problem is
that the variable is getting erased outside of the function holding
the new Ajax.request object.

I know this has to do with variable scope, but I'm running out of
ideas on how to make the value of my response.responseXML available to
functions outside of the one creating the new Ajax.request.  Any help
you could provide would be greatly appreciated.  Here is my code:

function stakeholderModel(strDataNeeded){
     new Ajax.Request('file_name.php'),
          {onSuccess: function(response) {
               globalVariable = response.responseXML
               },
          parameters: {parm1: parmValue}
     });
}

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to