0

I have an update panel on my page and inside $(document).ready() I am calling partial post back of the update panel. Once, the partial post back is complete, now I want to make some AJAX call as below

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

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

I want to make this AJAX call only when partial post back is complete. However, some how MyWebMethod() function is called even when partial post back is in progress. Is there any way to delay the AJAX call till the update panel partial post back is complete?

AshutoshPujari
  • 136
  • 2
  • 9

1 Answers1

0

You may try something like :


    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();
    }

    }
Yoric
  • 1,761
  • 2
  • 13
  • 15