Jeditable - Show Original Value After Submit
When I use jeditable in a table cell after the cell value is edited the value of the cell is changed with the value coming from the server:
I mean is the cell is
<td>old Value<td>
and I edit it and the server returns "new Value" jeditable inserts this value in the cell
<td>new Value<td>
Is there any way to avoid that the new value is inserted in the cell? I have tried with callback but开发者_运维百科 with no success:
callback : function(value, settings) {
return "false";
}
Thanks
Send back the old value from your PHP page in JSON form as {old_value : $_POST['value']}. and then in the callback do:
callback : function(data) {
$(this).text(data.old_value);
}
The callback function is called after the value has been placed in the cell so returning false (without quotes) wont do it!
So in your callback function change the value of the cell back.
callback : function(value, settings) {
$(this).text(old_value);
}
精彩评论