Loading ...
Sorry, an error occurred while loading the content.

11006Re: How to send argument to Connection Manager's startRequest function

Expand Messages
  • tssha
    Mar 21, 2007
    • 0 Attachment
      --- In ydn-javascript@yahoogroups.com, "andre22miami"
      <andre22wire@...> wrote:
      >
      > Hi,
      >
      > Thanks for the reply. I am familiar with the "argument:" option but it
      > doesn't offer what I'm looking for. It requires that I hard code the
      > argument in the callback declaration. I want to be able to send a
      > dynamic argument during the startRequest call:
      >
      > AjaxObject.startRequest(myarg)
      >
      > ...and have myarg available in the success handler. I still haven't
      > figured out how to do this.

      Define the property *argument* within startRequest. For example:

      var AjaxObject = {
      handleSuccess:function(o){
      // the alert will show 123
      alert(o.argument);
      },

      handleFailure:function(o){ alert('failed'); },

      startRequest:function(myarg) {
      // define argument here
      callback.argument = myarg
      var request = YAHOO.util.Connect.asyncRequest(
      'GET',
      'http://ue.corp.yahoo.com/tsha/php/get.php',
      callback
      );
      }
      };

      var callback = {
      success:AjaxObject.handleSuccess,
      failure:AjaxObject.handleFailure
      };

      // send a 'myarg' argument to the start function
      AjaxObject.startRequest(123);
    • Show all 4 messages in this topic