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

Calling a function when connection inside an object.

Expand Messages
  • kansalneha28
    Hi If I have all the connection manager code inside an object, how do I call the function such that each connection manager call creates a new object and helps
    Message 1 of 1 , May 7, 2006
    • 0 Attachment
      Hi

      If I have all the connection manager code inside an object, how do I
      call the function such that each connection manager call creates a new
      object and helps me with parallel ajax requests.

      var myObj = {};

      myObj.myFunction = function()
      {
      this.responseSuccess = function(res)
      {
      //success code.
      }

      this.responseFailure = function(res)
      {
      //failure code.
      }

      this.callback =
      {
      success:this.responseSuccess,
      failure:this.responseFailure,
      scope: this
      }

      YAHOO.util.Connect.asyncRequest('GET','url',myObj.callback,null);
      }

      So, in my jsp page if I call the function using the code:
      <a href="javascript:myObj.myFunction();">Test</a>

      That works, but it still doesnt solve the parallel ajax request
      problem. What can I do to create a new myObj for each request or any
      other way to make the parallel request work. Thanks.

      Neha.
    Your message has been successfully submitted and would be delivered to recipients shortly.