【问题标题】:Codeigniter: Not showing updated valuesCodeigniter:不显示更新的值
【发布时间】:2016-04-18 10:44:46
【问题描述】:

我正在使用 codeigniter。当我使用网站 UI 更新数据库值时,它会在数据库中更新,但在用户界面上它只显示旧值。刷新页面后,它显示更新的值。 请提出相同的解决方案。 谢谢。

【问题讨论】:

  • 您应该向我们提供更多信息,以便能够帮助您解决问题。向我们展示您的代码... :)

标签: php mysql codeigniter lamp


【解决方案1】:

您需要使用 AJAX。像这样的:

    data = {"slug" : slug};
    $.ajax({
         url: '', //url of controller where you would update the code using model
         method: 'POST', //method 
         data: data, //data to be updated
         dataType: 'json',
         contentType: 'json'
    })
    .done(function(res){ //Upadte html; Note the data in 'res' variable is the data which your above 'url' would echo 
    })
    .fail(function(res){//handle here if error occured
    });

希望这是您学习 AJAX 的良好起点。如果您提供一些代码,我会为您提供更多帮助。

【讨论】:

    猜你喜欢
    • 2021-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-14
    • 1970-01-01
    • 1970-01-01
    • 2019-07-22
    • 1970-01-01
    相关资源
    最近更新 更多