El cuadro de diálogo de la interfaz de usuario de Jquery se abre dos veces

I've got a problem with the UI Dialog.

After closing the dialog and reopening it, the dialog appears twice. One dialog with the old form data (which I dont want) and a new empty dialog.

I am closing the dialog after form submit in the following way:

$('.ui-dialog-titlebar-close').click();

I have also tried closing it this way:

$(this).closest('.ui-dialog-content').dialog('close');

Have anyone experienced similar behaviour?

preguntado el 28 de agosto de 12 a las 10:08

try destroy() method on it , if possible set up a fiddle in jsfiddle.net -

3 Respuestas

While closing make sure that the dialog self-destructs..

$("#dialog").dialog({
  .
  .
  .
  close: function(){
     $(this).dialog("destroy");// I also use .remove() but its redundant
  }
});

Respondido 28 ago 12, 10:08

Hi, Robin. I just noticed that even if the second dialog disappeard when using your tip it does two requests the next time I am posting my form.. Got any solution to this? - ffffff01

@f01: Making "two requests" to? Sorry I still don't get the picture. Probably a fiddle? Or you could even ask a separate question altogether. - petirrojo maben

tratan .dialog( "destroy" ) método. Dialog.destroy

$(this).closest('.ui-dialog-content').dialog('destroy');

Respondido 28 ago 12, 10:08

tratar de poner

          event.preventDefault():

which can stop the behaviour like this

Respondido 28 ago 12, 10:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.