简体   繁体   中英

How to refresh a table on the parent page when I close a popup window in PHP?

I have a table on a parent page users.php, populated with datas from mySQL. I have a button on the row ADD USER that opens a popup window that allows to add an user. The button is hidden when the user is already registered. I would like to refresh only the table and not the entire page when I close the popup after the form has been submitted. How can I do it properly?

using jquery

Create function with javascript in parent window something like

function reloadTable(){
 $.ajax({
 url: "tabledata.php",
 cache: false
 })
  .done(function( html ) {
    $( "#tablename" ).html( html );
  });
}

then in the child window use

    $( window ).unload(function() {
     window.opener.reloadTable();
   });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM