jQuery dialog box not opening 2nd time

Posted by Steven on Stack Overflow See other posts from Stack Overflow or by Steven
Published on 2009-09-23T21:28:23Z Indexed on 2010/03/24 4:53 UTC
Read the original article Hit count: 200

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about dialogbox