2010-01-09 59 views
1

有沒有一種方法可以檢測出其中一個插件使用$ .ajax成功完成ajax調用。 我使用了一個調用asp.net webservice的treeview插件,並且我想在上傳完成後將上下文菜單附加到分支/葉子上。jQuery:檢測ajax調用

+0

鉤$就功能 – jdigital 2010-01-09 17:57:14

回答

2

你有沒有看着$.ajaxComplete();$.ajaxSuccess();,或請求本身內部的回調函數:

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

看看其他Global Ajax Event Handlers

+0

真棒,我正要修改腳本來創建插件自定義事件。 – epitka 2010-01-09 17:58:31

0

使用「成功」功能

$.ajax({ 
     type: "POST", 
     url: "some.php", 
     data: "name=John&location=Boston", 
     success: function(msg){ 
     //the action to be done when the call is complete 
     } 
    }); 
+0

我無法使用成功功能,一個插件不知道另一個。 – epitka 2010-01-09 17:54:27