I want to execute some code inside a modal window that validates the data entered, if the data is saved successfully, I want to automatica开发者_运维问答lly close the modal window and refresh the parent window.
I've tried to call the modal close function, but no results.
<script>jQuery(function() {jQuery.modal.close();});</script>
Try this - in your main js:
// Open modal
$(foo).dialog();
// Listen for a trigger and close dialogue
$(foo).live('data_saved',function(){
$(this).dialog('close'); // close modal
}
In your modal js:
// Inside modal, save your data - execute a trigger
..whatever.trigger('data_saved');
精彩评论