tags:

views:

184

answers:

2

Is there a way to detect when one of the plugins successfully completes ajax call using $.ajax. I am using a treeview plugin that calls asp.net webservice, and I want to attach context menu to the branches/leafs once they've been loaded.

+2  A: 

Have you looked into $.ajaxComplete();, $.ajaxSuccess();, or the callback functions within the requests themselves:

$.post("somepage.php", {var:"val"}, function(results) {
  /* this is the callback, which happens after the response is received */
  alert(results);
});

Take a look at the other Global Ajax Event Handlers.

Jonathan Sampson
Awesome, I was about to modify the script to create custom event in the plugin.
epitka
A: 

Use the "success" function

$.ajax({
      type: "POST",
      url: "some.php",
      data: "name=John&location=Boston",
      success: function(msg){
        //the action to be done when the call is complete
      }
   });
kio
I cannot use success function, one plugin does not know about the other one.
epitka