updating x-editable input field based on returned value

javascript, x-editable

Solution

the simplest way:

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

remember to return newValue variable in response content:

{"newValue":"some_string_new_value"}

Problem

in my x-editable field I have a textarea that I want to update based on the returned value. This works when I use `$(this).html(newVal);` as shown below ``` success: function(response, newValue) { newVal=unescape(JSON.parse(response).VALUE) $(this).html(newVal); } ``` the problem is when I click to edit the field the second time, the value inside the input object (class: `editable-input`) stays the same as it was when it was sent. Is there a way to fix this?

Original source