How to alter a custom text field in a block with AJAX We have a block on a basic form listing several items and each item has a number of PDF files on the server to show by a users request.
Each item has an Id (nnn) which is displayed in a text field wrapped as &lt;div id='it_nnn'&gt;&lt;a href='call_ajax/nnn'&gt;item nnn&lt;/a&gt;&lt;/div&gt;
the object is when a user clicks the link, the div should be replaced by a list showing the links to the corresponding PDF files to download.
There are lots of Ajax examples that create their own form, but none so far that comes close to our application in replacing a div in a block.  We could do the Ajax request in a direct way but prefer to use the Drupal api's for stability and manageability, the only question remains is how to..  so examples or ideas are appreciated.
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.