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

Dan*_*iel 3 javascript x-editable

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

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

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

net*_*ead 6

最简单的方法:

        $('.textarea').editable({
            success: function(response, newValue) {
                    return {newValue: response.newValue};
                }
            }
        });
Run Code Online (Sandbox Code Playgroud)

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

{"newValue":"some_string_new_value"}
Run Code Online (Sandbox Code Playgroud)