简体   繁体   中英

refresh on screen data when database gets updated

I have this table:

http://puu.sh/drvIK/62086e6be8.png

When clicking the Edit button, the user gets moved to this page:

http://puu.sh/drvML/4a2652e48d.png

When they select aanpassen ( Accept in English) the database gets updated:

$sql="UPDATE IGNORE `personen` 
        SET gebruikersnaam = :gn, 
            wachtwoord = :ww, 
            voornaam = :vn, 
            tussenvoegsel = :tv, 
            achternaam = :an, 
            telnummer = :tn,
            opmerking = :op, 
            email = :email, 
            adres  = :adres, 
            foto = :foto 
       WHERE id = '".$_REQUEST['id']."' ";

When this finishes I forward the user back to the table in the first screenshot:

$this->forward('docentenOverzicht','directeur');

My problem is that this table still looks the same, the new data isn't in this table until the user refreshes his page, yet I want it to be updated as soon as they get forwarded to this page.

I'm sure it's a fairly simple fix, I just can't find anything on it.

You can set id for table row. ( 23 can be id of record )

<tr id='t23'><td>Name</td></tr>

And after update from database, you can refresh only table tr with ajax.

$.ajax({
        url: 'getData.php',
        method: 'GET',
        data: 'recordId=' + recordId,
        success: function(updatedData){
             $("#t23").html(updatedData);

        }
    });

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