Emebed jQuery update doesnt work ?

Asked by Durim Jusaj

Hello,

I have a problem with jQuery in embed, i get weather like text from my web i get it like json and update it in xibo, but first time it works fine, i set every 12 hour to make a request but it dosnt work nothing updates

here is my code from embed:

html: <style type="text/css">
 span.texti {
  font-size: 36px;
  color: #3b3b3b;
float:right;
 }
</style>

<span class="texti">- Min. Temp <span id="min"></span>°C, Max. Temp <span id="max"></span>°C | <span id="date"></span> | <span id="day"></span> | <span id="time"></span></span>

JS: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
function EmbedInit() {
getValues();
 showTime();
}

function getValues(){
 $.getJSON("http://mordor.rrota.com/2012/xibo/top_datas.php",
  function(data){
   $("#min").html(data.min);
   $("#max").html(data.max);
   $("#date").html(data.date);
   $("#day").html(data.day);
  }
 );
}
function showTime() {
 var today = new Date();
 var h=today.getHours();
 var m=today.getMinutes();
 var s=today.getSeconds();
 // add a zero in front of numbers<10
 h=checkTime(h);
 m=checkTime(m);
 s=checkTime(s);
 var ap = "AM";
 if (h > 11) {
  ap = "PM";
 }
 if(h == 12){
  getValues();
 }
 if(h == 00){
  getValues();
 }

 if(h == 0){
  getValues();
 }
 var time = h + ":" + m + " " + ap;
 $("#time").html(time);
 t = setTimeout('showTime()', 36000);
}
function checkTime(i) {
 if (i < 10) {
  i = "0" + i;
 }
 return i;
}
</script>

Thnx

Question information

Language:
English Edit question
Status:
Answered
For:
Xibo Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Durim Jusaj (durim) said :
#1

maybe i need to use older version of jquery or something like that

Revision history for this message
Dan Garner (dangarner) said :
#2

You actually don't need to include jQuery at all - we do that for you (that
might be the problem).

Revision history for this message
Durim Jusaj (durim) said :
#3

i remove jquery but $.getJSON dosnt work

Revision history for this message
Durim Jusaj (durim) said :
#4

the function getValues its called from function showtime is there any problem with functions

Revision history for this message
Dan Garner (dangarner) said :
#5

There is a possibility its not included with your Xibo version... it
definitely is in 1.3.2 onwards though.

Try the long hand way instead...

$.ajax({
  url: 'http://mordor.rrota.com/2012/xibo/top_datas.php',
  dataType: 'json',
  success: function(data) {
      $("#min").html(data.min);
      $("#max").html(data.max);
      $("#date").html(data.date);
      $("#day").html(data.day);
  }
});

Best thing to do is guess where the region is on the screen... right
click and "View Source". Save this file and you can see exactly what
Xibo is trying to show.

Revision history for this message
Durim Jusaj (durim) said :
#6

yeah i try this to but its not working
first time works perfect but i set there if its 12 oclock call getValues function again and this its not happen

Revision history for this message
Dan Garner (dangarner) said :
#7

Can you enable the mouse, right click, view source, save the page and
run through it locally?

Perhaps you're timer is not firing correctly, perhaps the result of
the AJAX is cached

Revision history for this message
Durim Jusaj (durim) said :
#8

yeah i already have do it in browser works perfect

Revision history for this message
Dan Garner (dangarner) said :
#9

Can you get the HTML file and share it with us?

Xibo will only embed your html in a local page, and open it... nothing more. When the duration you set it up, it will move on and replace it with whatever is scheduled next.

Can you help with this problem?

Provide an answer of your own, or ask Durim Jusaj for more information if necessary.

To post a message you must log in.