I have a jQuery dialog, and I use the open callback to load some data into via AJAX.
For example:
$('#dialog').dialog({
modal: true,
autoOpen: false,
open: function(){
$('.content', this).load('/path/to/file', function(){
// even more code
});
// more code
}
});
While the dialog is already open, I want to re-load the data via AJAX. I figured that I could just trigger the open function I bound above. I read in the docs that you can bind to that open event using $(".selector").bind("dialogopen", function(event, ui){}), so I figured I could trigger the event that way too.
I tried $('#dialog').trigger('dialogopen'), but nothing happened. How can I trigger the open event of a jQuery dialog?
Currently, I figured out that I could use $('#dialog').dialog('option', 'open')(), but that's ugly, there's gotta be a better way!