JEDITABLE EXAMPLE


/ Published in: jQuery
Save to your folder(s)

simple jquery jeditable example


Copy this code and paste it in your HTML
  1. $('.edit').editable(submitEdit, {
  2. indicator: '<img src="/images/indicator.gif">',
  3. id : $(this).attr('tradu'),
  4. tooltip: 'editar',
  5. cancel: 'cancelar',
  6. submit: 'ok',
  7. event: 'edit'
  8. });
  9. /* Find and trigger "edit" event on correct Jeditable instance. */
  10. $(".edit_trigger").bind("click", function () {
  11. $(this).parent().prev().trigger("edit");
  12. });
  13.  
  14.  
  15. function submitEdit(value, settings)
  16. {
  17. var origvalue = this.revert;
  18. var textbox = this;
  19. var result = value;
  20. var edits = 'nuevo='+value+'&anterior='+origvalue+'&id_string='+$(this).attr('tradu')+'&lang=<?=$lang?>';
  21.  
  22. var returned = $.ajax({
  23. url: "/procedures/saveTranslation.php",
  24. type: "POST",
  25. data : edits,
  26. complete : function (xhr, textStatus)
  27. {
  28. var response = xhr.responseText;
  29. if (response != "")
  30. {
  31. alert(response);
  32. }
  33. }
  34. });
  35. return(result);
  36. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.