2014-10-08 85 views
0

我在我的頁面和裏面有一個更新面板$(document).ready()我打電話給更新面板的部分回發。一旦,部分回發完成後,現在我想做出一些AJAX調用如下只有在部分回發完成後調用AJAX方法

__doPostBack('<%=updatePanel1.ClientID %>', null); 

$.ajax({ 
    type: "POST", 
    url: "MyWebLink.aspx/MyWebMethod", 
    contentType: "application/json; charset=utf-8", 
    dataType: "json", 
    success: function (response) { } 
}); 

我想使這個AJAX調用僅在局部回傳完成。但是,即使在進行部分回發時,也會調用某些MyWebMethod()函數。有什麼辦法可以延遲AJAX調用,直到更新面板部分回發完成?

+0

可能重複:http://stackoverflow.com/questions/7615691/callback-after-dopostback – 2014-10-08 06:52:04

回答

0

您可以嘗試類似:


    function callAjaxMyWebMethod() { 

    $.ajax({ 
     type: "POST", 
     url: "MyWebLink.aspx/MyWebMethod", 
     contentType: "application/json; charset=utf-8", 
     dataType: "json", 
     success: function (response) { } 
    }); 

    } 

    $(document).ready(function() { 

    function doPostBack() { 
     // Here, do your Update Panel work 
     callAjaxMyWebMethod(); 
    } 

    } 
相關問題