Use this function to load all modal dialogue popups
function ShowPopup(popupID, pageUrl) {
$("#" + popupID).empty();
$("#" + popupID).dialog({
autoOpen: false,
modal: true,
resizable: false,
height: 'auto',
width: 565 //set width of pop up
});
$("#" + popupID).html(popUpLoaderHtml);
$.ajax({
type: 'GET',
url: pageUrl,
cache: false,
success: function (data) {
$("#" + popupID).empty();
$("#" + popupID).append(data);
}
});
$("#" + popupID).dialog("open");
}
Customise this method for any modal dialogue like this
function ShowCommentEditPopUp(popupID, CommentId) {
ShowPopup(popupID, '/comments/edit/' + CommentId);
}
Here the 'popupID' is the ID of the div where popup is loaded