tuupola/jquery_jeditable — pull request #66 by randell (2012-06-28 02:21:40+00:00)
Title: Added intercept function, which is useful for handling JSON responses.

Useful when you want to post-process the returned json data before it hits the page.

For example, your server returns the following json string: { "status": 1, "result": "value to be displayed", "other": "some other data" }, and you would like to process the "status" and "other" fields, and display the "result" field in the jeditable input field.

In your own code, you can do something like the following:

```$(some_field).editable(
'/some_url_on_your_server',
{
indicator : "",
tooltip: "Click to edit.",
indicator: "Saving...",
onblur: "submit",
intercept: function (jsondata) {
obj = jQuery.parseJSON(jsondata);
// do something with obj.status and obj.other
return(obj.result);
},
etc.```
This allows you do cool stuff like having your server convert abbreviations to full strings etc.

Enjoy!

From: http://stackoverflow.com/a/4611865/106778