📜  Glide Ajax 客户端脚本 ServiceNow - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:37.242000             🧑  作者: Mango

代码示例1
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);
}