Posted By

eowynx on 03/22/12


Tagged

edit jquery Online jeditable


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

BrockSamsom


JEDITABLE EXAMPLE


 / Published in: jQuery
 

simple jquery jeditable example

  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  

You need to login to post a comment.