Results 1 to 2 of 2

Thread: AjxRpc callback changes?

  1. #1
    Join Date
    Apr 2007
    Posts
    29
    Rep Power
    8

    Default AjxRpc callback changes?

    Did anything change between 4.5.5 and 5.0.2 in how AjxRpc callbacks are done? I'm using the code below, but the callback never fires. I verified with Firebug that the server is returning data (just plain text). Ideas?

    Code:
    Com_Zimbra_Phone._doCallTo = function(phone) {
    	var stURL = 'http://asterisk.domain.com/user/c2c.php?dst=' + encodeURIComponent(phone) + '&ai=' + AjxCookie.getCookie(document,'authinfo');
    	var url = ZmZimletBase.PROXY + escape(stURL);
    	if (confirm('Are you sure you want to call ' + phone + '?')) {
    		AjxRpc.invoke(null, url, null, new AjxCallback(this, this._doCallToCallback), true);
    	}
    }
    
    Com_Zimbra_Phone._doCallToCallback = function(response) {
    	alert(response.text);
    }

  2. #2
    Join Date
    Sep 2005
    Posts
    55
    Rep Power
    10

    Default

    Quote Originally Posted by code0 View Post
    Did anything change between 4.5.5 and 5.0.2 in how AjxRpc callbacks are done? I'm using the code below, but the callback never fires. I verified with Firebug that the server is returning data (just plain text). Ideas?

    Code:
    Com_Zimbra_Phone._doCallTo = function(phone) {
    	var stURL = 'http://asterisk.domain.com/user/c2c.php?dst=' + encodeURIComponent(phone) + '&ai=' + AjxCookie.getCookie(document,'authinfo');
    	var url = ZmZimletBase.PROXY + escape(stURL);
    	if (confirm('Are you sure you want to call ' + phone + '?')) {
    		AjxRpc.invoke(null, url, null, new AjxCallback(this, this._doCallToCallback), true);
    	}
    }
    
    Com_Zimbra_Phone._doCallToCallback = function(response) {
    	alert(response.text);
    }
    AjxRpc.invoke hasn't changed. The problem is that you're creating a callback with an object context, but your function is static. You should either make your class concrete, using a prototype so that there's a "this", or change your callback to:

    new AjxCallback(null, Com_Zimbra_Phone._doCallToCallback)
    Bugzilla - Wiki - Downloads - Before posting... Search!

Similar Threads

  1. ZmZimletBase.PROXY when using AjxRpc
    By JAdj in forum Zimlets
    Replies: 3
    Last Post: 06-19-2007, 06:07 AM
  2. AjxRpc and Ports?
    By mghaught in forum Zimlets
    Replies: 7
    Last Post: 03-22-2006, 03:18 PM
  3. AjxRpc vs. ZmCsfeAsynchCommand
    By Heladito in forum Developers
    Replies: 1
    Last Post: 10-31-2005, 08:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •