2014-10-08 89 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(); 
    } 

    } 
相关问题