GlideAjax error - Client Script

Anil74
Tera Guru

Hi All,

I am trying to display current date and time as alert message on form load using onload client script and script include, but getting below error message in logs.

Script: u_u_person not found in scope: global, and HTTP Processor class not found: com.glide.processors.xmlhttp.u_u_person: no thrown error.

below are my script include and onload client scripts.

********Script Include**********

var TodaysDate = Class.create();

TodaysDate.prototype = Object.extendsObject(AbstractAjaxProcessor, {

   

todayDate: function ()

{

return gs.nowDateTime(); },

type: 'TodaysDate'

});

***********Onload Client Script*******

function onLoad() {

    //Type appropriate comment here, and begin script below

    var ajax = new GlideAjax('u_u_person');

ajax.addParam('sysparm_name', 'TodaysDate');

ajax.getXML(function (){

var date = ajax.getAnswer();

alert(date);

    });

}

anyone can explain me where did i made mistake.

Thank you.

4 REPLIES 4

Gaurav Bajaj
Kilo Sage

Hi Anil.



I hope your script include name is u_u_person since the client script has the same while creating GlideAjax object.



AJAX



Thanks


Gaurav


Inactive_Us1474
Giga Guru

Is your u_u_person in global scope and is the persmission allowed?


sachin_namjoshi
Kilo Patron
Kilo Patron

If the script include is in a scope, and the catalog item is global, you need two things


  • Check that the script include is available to all scopes (it's in the upper right of the form)
  • address your script include with the scope name prefix. E.g. javascript:new myscope.myScriptInclude().myFunction()


Regards,


Sachin


Anil74
Tera Guru

Thank you All.


i tried with below client script and its working for me.


in Previous code i gave table name instead of script include name.


function onLoad() {


    //Type appropriate comment here, and begin script below


    var ajax = new GlideAjax('TodaysDate');


ajax.addParam('sysparm_name', 'todayDate');


ajax.getXMLAnswer(function (answer){


var date = answer;


alert(date);


    });