duanpu1064 2014-12-12 11:28
浏览 27

数据库更新时刷新屏幕数据

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.

  • 写回答

1条回答 默认 最新

  • douzhiling3166 2014-12-12 11:37
    关注

    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);
    
            }
        });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥15 树莓派5怎么用camera module 3啊
  • ¥20 java在应用程序里获取不到扬声器设备
  • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
  • ¥15 Attention is all you need 的代码运行