Dialog close when clicking link

Dialog close when clicking link

Hey everyone,

I have a made a page which show data from a database. When clicking upon a field a dialog box is opent, within this dialog is a form.

This page is loaded into an index page using the .load function. Everything is working just except when i load a different page into the index.php the dialog stays opent. Is it possible to automaticly close a dialog when loading a different page into the index.php.

i load the page using this function

  1. function info(){
  2. $('#test').load('info.php');
  3. }

and my dialog looks like this

  1.   $(function(c) {
  2.     $( "#dialog" ).dialog({
  3.       autoOpen: false,
  4.         width: 260,
  5.         height: 85
  6.     });
  7. $( "#dialog" ).dialog({
  8. position: { 
  9. my: 'left, top',
  10. at: 'right, top',
  11. of: $('#opener')
  12. }
  13.  });
  14.     $( "#opener" ).click(function() {
  15.       $( "#dialog" ).dialog( "open" );
  16.   
  17.     });

  18. });