I have done exactly this for my site. This should get you started.
$("#editable_text").editable(submitEdit, {
indicator : "Saving...",
tooltip : "Click to edit...",
name : "Editable.FieldName",
id : "elementid",
type : "text",
});
function submitEdit(value, settings)
{
var edits = new Object();
var origvalue = this.revert;
var textbox = this;
var result = value;
edits[settings.name] = [value];
var returned = $.ajax({
url: "http://URLTOPOSTTO",
type: "POST",
data : edits,
dataType : "json",
complete : function (xhr, textStatus)
{
var response = $.secureEvalJSON(xhr.responseText);
if (response.Message != "")
{
alert(Message);
}
}
});
return(result);
}
You need to return a Json response of the form
{ "Message" = "FOO" }
And that will be displayed in the alert.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…