In this article I will explain how to show jQuery UI Dialog modal popup after jQuery AJAX call is completed inside the Success event handler in ASP.Net.
The jQuery UI Dialog is initialized before the jQuery AJAX call but it is shown on the page after the response is received by the jQuery AJAX call.
HTML Markup
The below HTML Markup consists of a TextBox to enter some content, a Button for triggering jQuery AJAX call and a DIV for displaying jQuery Dialog.
<table border="0" cellpadding="0" cellspacing="0">
        <input type="text" id="txtName" value="" />
        <input type="button" id="btnSubmit" value="Submit" />
<div id="dialog" style="display: none">
The WebMethod
In order to illustrate the functioning, I’ll be making use of an ASP.Net WebMethod which will simply return the name sent by the jQuery AJAX call back as response. But this solution is not restricted only to ASP.Net and it can be easily used for other technologies too.
public static string SendParameters(string name)
    return string.Format("Name: {0}", name);
Open (Show) jQuery Dialog Modal Popup after AJAX Call inside its Success event handler
Inside the document ready event handler, I have applied the jQuery Dialog Modal Popup plugin to the DIV.
When the Button is clicked a jQuery AJAX call is made to the WebMethod and inside the success event handler the value received from the server is displayed in the DIV and then the jQuery Dialog Modal Popup is opened.
<script type="text/javascript" src=""></script>
<script src="" type="text/javascript"></script>
<link href=""
rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(function () {
        autoOpen: false,
        modal: true,
        title: "Details",
        buttons: {
            Close: function () {
    $("#btnSubmit").click(function () {
            type: "POST",
            url: "Default.aspx/SendParameters",
            data: "{name: '" + $("#txtName").val() + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (r) {
Open (Show) jQuery Dialog Modal Popup after AJAX Call Success