shd_ajax()
shd_ajax()
Receives AJAX requests and facilitates replying to them.
This function sets up and calls the AJAX handlers; it is the primary receiver for action=helpdesk;sa=ajax.
Primarily, it expects $context['ajax_return'] to be populated as an array of tags to be returned as XML items to the user, with this element being a key-value pair (e.g. $context['ajax_return']['message'] = 'Success!') to be returned as a literal tag, element message, value of Success!, wrapped in the character data block.
An AJAX handler function may also return content in $context['ajax_raw'], this is when the function has prepared its own XML block to return. In such an instance, this function simply outputs the xml headers and assumes the return value is otherwise value.
For example, if the error subarray is populated (['error'] = 'Insufficient permission'), the XML block will contain a tag called error, with a CDATA block containing 'Insufficient permission'.