I'm trying to use the jQuery UI Dialog to provide a small pop-up that brings some information about a customer and shows a form. Everything works fine, except that it only works for the first click. If I try to click the same button again, or another one I get the error message:
Uncaught Error: cannot call methods on dialog prior to initialization; attempted to call method 'option'
I've managed to figure out it has to do with the closing/destroying of the dialog, but I don't understand what I'm doing wrong. If I comment the part $(this).dialog('destroy');
then at least the dialog works but I get a different error
Uncaught TypeError: Object Exclude something has no method 'dialog'
I've tried with jQuery 1.8.3/1.9.1 with jquery-ui-1.9.2 and I get the same problem.
This is what I have set up: http://jsfiddle.net/ycZpQ/