Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

UI Page ( Client script not working)

AmitOberoi
Tera Contributor

I am new to ServiceNow and need some guidance in troubleshooting my code. I created a UI Page. In which I am calling a script incude ( to load a info. in a table using client script ).

Button click ( Add Dog ) should do the job but not reacting on click.

 

AmitOberoi_0-1736290301089.png

 

jQuery('#addDog').click(function() {
    var ga = new GlideAjax('fetchUtils');
    alert('first check');
    ga.addParam('sysparm_name', 'createDog');
    ga.addParam('sysparm_dog_name', jQuery('#dogName').val());
    ga.addParam('sysparm_dog_age', jQuery('#dogAge').val());
    ga.addParam('sysparm_dog_neutered', jQuery('#dogNeutered').is(':checked'));
    ga.addParam('sysparm_dog_shots', jQuery('#dogShots').is(':checked'));
    ga.getXML(fetchBallback);
});

function fetchBallback(response) {
    alert('2 check');
    var answer = response.responseXML.documentElement.getAttribute('answer').split('|');
    jQuery('#msg').append('<p>' + answer[0] + 'has succesfully been created. Dog ID: ' + answer[1] + '</p><br/><a href="' + answer[2] + '">View new dog</a>');
}
0 REPLIES 0