weixin_33736048 2017-05-02 13:44 采纳率: 0%
浏览 40

可编辑和AJAX重新加载

I have a table that i load with AJAX and edit with Jeditable. This is how i start my function:

function refresh_page() {
var tableElm = $('#refresh');
$.ajax({
    url: 'assets/php/ritsys/my_table.php',
    success: function(data) {
        if (!($("*:focus").is("textarea, input, select, date, time")) ) {
            tableElm.html(data)
        }
        $(function(){
            $('.edit').editable('assets/php/ritsys/save.php', {
                indicator : '<img src="assets/css/smoothness/images/ui-anim_basic_16x16.gif">'
            });
        });
        setTimeout(refresh_page, 1500);
    }
}); };

This works fine and i added the if (!($("*:focus").is("textarea, input, select, date, time")) ) { line because i had problems with the data refreshing while i was editing something in the table.

But after i added this everytime when i update a value in the table firstly it shows me the indicator image, then the old value and after that the new value.

Before it would briefly show the indicator and then the new value. Can somebody help me to cut out the step where it shows the old data?

It would be greatly appreciated!

  • 写回答

1条回答 默认 最新

  • 谁还没个明天 2017-05-04 09:33
    关注

    Does the script assets/php/ritsys/save.php return the "new" value? You should return the "new" value, not the "old" value. The returned value will be shown when the request is complete.

    评论

报告相同问题?

悬赏问题

  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私