I am using the JEditable jquery plugin to update some data on my web page. After saving the data through the JEditable plugin on the server, I want to replace the old content in the div container with the new one, which is actually different from the inserted data (the application processed the data before saving and added additional information using This).
I tried using the code below, it works for the first time, but as soon as the data is replaced in the div container, editable functions are lost.
$(".editableComments").editable( function(value, settings) { selectedId = $(this).attr("id"); $.ajax({ url:'ajaxApproveRequests', type:'post', data:{ requestType: "Trans", idList : $(this).attr("id"), comment: value }, success: function(data) { if (data != "Error") { $("#"+selectedId).html(data); } }, error: function(req) { alert("Error in request. Please try again later."); } }); }, { indicator : "Saving...", type : 'textarea', submit : '<input type="button" id="okBtn" value="Ok" onMouseOver="rollOnAutoButton(this)" onMouseOut="rollOffAutoButton(this)" class="autobtn" >', cancel : '<input type="button" id="cancelBtn" value="Cancel" onMouseOver="rollOnAutoButton(this)" onMouseOut="rollOffAutoButton(this)" class="autobtn" >', cssclass : "editableArea", rows: 5, cols: 25, onblur : "ignore" });
HTML code:
<div class="editableComments">some data</div>
Please suggest where do I do wron? Thanks in advance.
source share