Glide Ajax Client Script ServiceNow
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
var ga = new GlideAjax('serverCheck');
ga.addParam('sysparm_name', 'serverFunctionName'); //sysparm_name is reserved for the name of the script include function to call
ga.addParam('sysparm_group', g_form.getValue('assignment_group'));
ga.addParam('sysparm_other_variable', g_form.getValue('short_description')); //Any variable can be sent
ga.getXML(clientCallback); //Use getXML rather than getXMLWait. Input is your callback function
}
function clientCallback(response) {
var answer = response.responseXML.documentElement.getAttribute("answer"); //Get answer from server
//Do something with answer
g_form.setValue('short_description', answer);
}
Envious Elk