Skip to content

Instantly share code, notes, and snippets.

@richardbenson
Created December 8, 2011 10:13
Show Gist options
  • Save richardbenson/1446631 to your computer and use it in GitHub Desktop.
Save richardbenson/1446631 to your computer and use it in GitHub Desktop.
Why I love jQuery
function createDialog(strName, intWidth, strHeader, strTemplate, funcOnLoad, objButtons) {
var dialog = $('<div id="' + strName + '"><div style="text-align: center"><img src="/assets/images/ajax-loader.gif" /></div></div>').dialog({
modal: true,
open: function () {
if (typeof (strTemplate) != "undefined") $(this).load(strTemplate, funcOnLoad);
},
close: function (event, ui) {
$(this).remove();
},
width: intWidth,
title: strHeader,
resizable: false
});
if (typeof (objButtons) != "undefined") $(dialog).dialog("option", "buttons", objButtons);
return dialog;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment