The CreatorCon Call for Content is officially open! Get started here.

Glide AJAX is not working ( from a catalog client script)

Gal1
Kilo Guru

Hi Experts,

My goal is to be able to call a server script with glideAjax from a catalog client script, which related to a record producer. right now I'm getting null as an answer (from the glideAjax) and also my logs on the script include are not executed. 

Please help, what am I missing?

 

 

record producer:

 

find_real_file.png

find_real_file.png

find_real_file.png

catalog client script : 

find_real_file.png

 

script include:

 

find_real_file.png

1 ACCEPTED SOLUTION
26 REPLIES 26

var symptom_category = g_form.getValue('subcategory');
var gaSymptomCode = new GlideAjax('sn_customerservice.IND_Symptoms_tst');
gaSymptomCode.addParam('sysparm_name', 'IND_Symptom_code_RP_function');
gaSymptomCode.addParam('sysparm_symptom_category', symptom_category);

gaSymptomCode.getXMLAnswer(getAnswer);
function getAnswer(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
}

The above is invalid code getXMLAnswer natively calls to the answer attribute, doing it twice will result in an invalid object. The below will work to generate an alert message based on the response.

I've used "new_value" as your script is running onChange of the category variable so you don't need to seperately use g_form to get its value.


var gaSymptomCode = new GlideAjax('sn_customerservice.IND_Symptoms_tst');
gaSymptomCode.addParam('sysparm_name', 'IND_Symptom_code_RP_function');
gaSymptomCode.addParam('sysparm_symptom_category', newValue );

gaSymptomCode.getXMLAnswer(function(response){
alert(response);
});

Hi Anson,

I tried it also and it didn't help. 

Thanks

 

Quick testing.

 

Can you try to create a script include in global scope and set accessible for all application scope. 

 

Also best practice,your function name should not be so long. 

 

 

 

I tried it. it didnt help

Hmmm.. Can you try this way?

 

Create new script include and client script. 

Just add log and return "hello" from your script include . 

then check the log and see if its coming or not.