根据返回值更新x-editable输入字段

 莪啝伱在一敧 发布于 2023-02-13 07:36

在我的x-editable字段中,我有一个textarea,我想根据返回的值更新.这在我使用时$(this).html(newVal);如下所示

success: function(response, newValue) {
  newVal=unescape(JSON.parse(response).VALUE)
  $(this).html(newVal);
}  

问题是当我第二次点击编辑字段时,输入对象(class editable-input:)中的值保持与发送时相同. 有没有办法来解决这个问题?

1 个回答
  • 最简单的方法:

            $('.textarea').editable({
                success: function(response, newValue) {
                        return {newValue: response.newValue};
                    }
                }
            });
    

    记得在响应内容中返回newValue变量:

    {"newValue":"some_string_new_value"}
    

    2023-02-13 07:55 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有