I found this thread which basically has the same issue I have. But their solution is not working for me.
The dialog appears the first time I click the submit button, but not the 2nd time. I'm opening the dialog box after a form submission.
UPDATE
I finally got it working. Here is the correct code:
if (jQuery('#registrationforms').length > 0) {
//instantiate the dialog
jQuery("#dialog").dialog({ modal:true, autoOpen:false });
//Some more code here to call processRegistration function.
}
function processRegistration(instanceID, formData)
{
jQuery.post("mypath/jquery_bll.php", { instance: 'processRegistration', formData : formData, instanceID : instanceID },
function(feedback)
{
jQuery('#dialog').text(feedback.message);
jQuery('#dialog').parent().addClass(feedback.type);
jQuery('#dialog').dialog('open');
},"json");
}
Since I'm dynamically applying css class, I have to make sure to add it to the outer DIV which $.dialog creates to wrap my 'dialog' DIV.