I’m trying to add a close a jquery ui dialog box from an ajax loaded content.
Here is some code :
<script>
$(".add_as_friend").click(function(){
$("#dialog-modal").load("/friends/add_popup/"+$(this).attr('id')).dialog({
title: sprintf('<?=_("Ajouter %s comme ami");?>',$(this).attr('rel')),
width: 500,
height: 350,
modal: true,
buttons: {
"<?=_("Annuler");?>": function() {
$( this ).dialog( "close" );
}
}
});
});
</script>
and the call to close it from the ajax would be something like
$(".add").click(function(){
//submit a form
// close modal box and redirect main window
});
You could try calling the dialog.close() method on the div you turned into a dialog.