How to alter a custom text field in a block with AJAX
You have some examples in "Examples for Developers" https://www.drupal.org/project/examples

If you see in ajax_example module, you have "Ajax Link" which points to the url ajax_link_callback,  (defined by  menu hook ajax_link_callback in file ajax_example.module, line 181).
This menu hook has a callback function (see file ajax_example_misc.inc, line 102), which does the magic.

You can see that the ajax response is made with a few components. First the $commands array with the target div and the content to output. Then this array is wrapped in another array ($page), and delivered by the function: ajax_deliver.

Note that the original link ( which is produced by the menu callback ajax_example_render_link() in file ajax_example_misc.inc, line 22), has a use-ajax class attribute and previously the drupal.ajax library is added to the page.