Javascript - change text automatically every 10 secodns

Pastupe
Mega Guru

Hi,
I need help please. Im beginner in javascript and I learn everething from beginning.

I created UI page.
Result is that UI page display several records each to other (kb query - gliderecord ).
I would like to display every record separately one by one changing every 10 seconds.
See example on screen that now they display all one behind another ....
Is there any change to use javascript to show my variable 1 per 10 seconds which I call $[jvar_inc_link] ?

I would like to learn this how to create code to show results from $[jvar_inc_link] every 10 seconds ..

thanks to all
Petr

23 REPLIES 23

Kostya
Tera Guru

Hi, it is more JavaScript question and less ServiceNow. I would do such kind of thing with jQuery. First of all laoding all Links to an array and than displaying them one after other. I am sure you will find something if you google for "jquery refresh" or "ajax refresh div" or "jquery setInterval"

best regards


Hit the Thumb Icon and/or mark as Correct, if my answer was correct. So you help others to see correct responses and I get fame 🙂

Cheers,
Kostya

Hi,
thanks a lot for answer.
Im new in javascript so I lear and all is new for me.
What I did is that I builded my new function which show 3 different values one by one based on interval 5 seconds. Function is attached in TEXT file below.

1. Could you tell me why this not work in our Instance ? I created UI page and it dont work. It work only as HTML page if I save any on my local disk.
Thank you


Hello,

what exactly does not work? Any error message?
The ui page has to have the correct Jelly / XML format. The page should look like


<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
// here is your page
</j:jelly>


Kind regards


Hit the Thumb Icon and/or mark as Correct, if my answer was correct. So you help others to see correct responses and I get fame 🙂

Cheers,
Kostya

Here is the code,
Prolem is that numbers dont change.
See my code, if you save it to local disk as HTML and open, then numbers are changed automatically on html page.

But in the SN tool, only ifrst number is displayed and other numbers dont.
Dont know what i do wrong.

Petr