Both container id and url can be set at any time, that is to say: at any place in the code, whether in plugin code or in skin template code.
A number of additional (optional) properties can be set as well, see below at Table of request properties.

But load would immediately invoke the loading of the HTML - convenient, but too fast. A better design would be to set the properties for the request and let other code change these if necessary.

Caching results

Some content should be loaded only once. For instance, when a twisty is used to display dynamic contents it is not always desirable to reload the content each time the twisty is opened. Instead we want the twisty to close and reopen with the same content.

Use property cache:true to store the fetched results and display these again with a next request.

Cached contents can be cleared with twiki.AjaxRequest.clearCache("request_id").

Processing HTML

The default processing handler is twiki.AjaxRequest._writeHtml that writes the fetched HTML content in the appointed container.

Assign a custom processing handler with the properties handler (the processing function) and scope (the function owner).
The function itself should accept 2 parameters: inId and inHtml, and should return the processed HTML so it can be cached.

The processing handler can use several ways to manipulate the incoming HTML:

XML Data handling

Loading ready HTML is the easiest use of TWikiAjaxContrib as it requires no data processing. But if you want to harness Web Services you will most likely encounter XML data. To interpret and convert XML to HTML you will need a processing handler.

Assign a custom processing handler with the properties handler (the processing function) and scope (the function owner).
The function itself should accept 2 parameters: inId and inHtml, and should return the processed HTML so it can be cached.