tuupola/jquery_jeditable — Issue #50: Using jeditable with custom function returns undefined
Author: theindustry
Created: 2011-11-03 08:58:06+00:00
State: open

Hi tuupola,

I need to use a custom function to save my input from the jEditable element, as I need to show a dialog (jQuery UI's) to propmt the user that he/she made the correct edit.

Unfortuantely it seems that jEditable doesn't wait for the AJAX call and instead of the returned value from the AJAX call, displays undefined on the page.

Any ideas?

Here's the code:

$('#quickEdit').editable(quickEditable, {
loadurl: url.quickEditable
});

function quickEditable(value, settings) {

var defaultValue = this.revert;

// Check that the value is changed.
if (defaultValue == value) {
return defaultValue;
}

$("#dialog").dialog({
buttons: {
"OK": function() {
$(this).dialog("close");
return $.ajax({
type: "POST",
url: url.quickEdit
async: false,
data : {/* Some data */}
}).responseText;
},
"Abort": function() {
$(this).dialog("close");
return defaultValue;
}
}
});
}