JSOM SharePoint Open Dialog Feature

Page with a url can be opened with the following javascript code;

CODE



Page with html content can be opened with the following javascript code;

CODE



Dialog return value can be captured with the following javascript code;

CODE



Dialog windows can be closed with the following syntaxes
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.Cancel);
Or
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK);