/ Published in: jQuery

simple jquery jeditable example
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$('.edit').editable(submitEdit, { indicator: '<img src="/images/indicator.gif">', id : $(this).attr('tradu'), tooltip: 'editar', cancel: 'cancelar', submit: 'ok', event: 'edit' }); /* Find and trigger "edit" event on correct Jeditable instance. */ $(".edit_trigger").bind("click", function () { $(this).parent().prev().trigger("edit"); }); function submitEdit(value, settings) { var origvalue = this.revert; var textbox = this; var result = value; var edits = 'nuevo='+value+'&anterior='+origvalue+'&id_string='+$(this).attr('tradu')+'&lang=<?=$lang?>'; var returned = $.ajax({ url: "/procedures/saveTranslation.php", type: "POST", data : edits, complete : function (xhr, textStatus) { var response = xhr.responseText; if (response != "") { alert(response); } } }); return(result); }
Comments
