Updating text? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Updating text?

Hi, I have been having some trouble recently trying to create a "live" currency count; whenever I change the currency variable, it doesn't update the currency written on the document unless you refresh the page. I have seen people make scripts so that it auto updates when changed. Can someone explain how this is done to me? Any help is always appreciated 😃

17th Apr 2017, 1:01 PM
iBrandon
iBrandon - avatar
8 Answers
+ 3
you can check my SessionTimer code. Only native js. Just change element with js or jq which you need to change with needed interval. Hope you don't need to get values from other source(site/file) :D If you need...you'll need to get it with some interval +change values inside of element same way.
19th Apr 2017, 10:50 PM
Rose Sevenyears
Rose  Sevenyears - avatar
0
you need to send requests every 10sec-1min to check the currency value
17th Apr 2017, 1:07 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
0
Ok, is there a command / function to do so?
17th Apr 2017, 1:13 PM
iBrandon
iBrandon - avatar
0
setInterval + AJAX
17th Apr 2017, 1:16 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
0
Ok, I understand setInterval, but can you explain what AJAX is?
17th Apr 2017, 1:17 PM
iBrandon
iBrandon - avatar
17th Apr 2017, 1:19 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
0
Is there a simpler way to do this? It is kind of confusing 😂
17th Apr 2017, 3:32 PM
iBrandon
iBrandon - avatar
0
check my Chat code there is a function tick() check for new messages
17th Apr 2017, 3:44 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar