GlideAjaxV3 - getXMLAnswer(Function callback)

Call the processor asynchronously and get the answer element of the response in XML format.

Table 1. Parameters
Name Type Description
callback Function The callback function. The function receives the answer element of the response in XML format as an argument.
Table 2. Returns
Type Description
void
function updateAttachmentCount(sysid) {
    var ga = new GlideAjax('AttachmentAjax');
    ga.addParam('sysparm_type', 'attachmentCount');
    ga.addParam('sysparm_value', sysid);
    ga.getXMLAnswer(numberOfAttachments, null, sysid); // callback: numberOfAttachments
}

function numberOfAttachments(answer, sysid) {
	// we want to know there are 5 attachments, not 5.0 attachments
	var number = parseInt(answer);
	var buttons = $$('.attachmentNumber_' + sysid);
	if (buttons[0] == undefined)
		$('header_attachment_list_label').down().innerHTML = number;
	else {
		for (var i = 0; i < buttons.length; i++) {
			buttons[i].innerHTML = number;
		}
	}
}