Hi I am having an issue with closing my jquery dialog.
What I have is a comet connection that sends messages to my browser. What I would like to do is when I receive a message I want to do some stuff, close the dialog then do some more stuff. Unfortunately when I execute: $(‘#dialog’).dialog(“close”); It ends my current javascript code. Is there a way to avoid this? or do I need to make sure the close is run right at the end using a variable?
For example, here you can see that my text will not change when it is after:
http://jsfiddle.net/hKhMC/
This is a simple demonstration my actual code does a lot of calculations afterwards so I was wondering if there was a solution that doesn’t involve moving the text before the close.
You are recursively firing the dialog close event. In Chrome your jsfiddle example causes a
Uncaught RangeError: Maximum call stack size exceeded. This is because the.dialog('close')method fires thedialogcloseevent after closing the dialog. This event is also fired when someone clicks theXbutton on the dialog toolbar or presses theESCkey.However you are binding this event during the dialog initialization and then calling the same method that can trigger it again.