HTML producer and javascript functions


I'm using an html template for lower-thirds for a production im involved in.

I'm having issues updating a table with new data using a js function. Is there any limitation to the way data can be updated on a template?
Does it have to go through a websocket?

Right now I parse the JSON string coming from play(str) and then call an updateData() function.

updateData() is as follows:
var table = document.getElementById('countries_list');

for (i = 0; i < window.countries_array.length; i++) {
table.innerHTML += "<tr><td>" + countries_array + "</td></tr>";

The loop does nothing. I'm out of ideas.
Also console.log doesn't show up in casparcg logs, is there a way to make it so?

Re: HTML producer and javascript functions

Does it work, when you play it the first time? So only update fails? Would you not need to initialize the innerHTML before the loop? Otherways it will become longer every time you call this, isn't it? (I am bad at HTML and JavaScript, so please take these remarks only as guesswork).
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland
Problems? Guide to posting Bug reports & Feature requests

Re: HTML producer and javascript functions

hm, I think that Caspar will call first call "update(String)" and then "play()", I don't recall the "play" function taking any arguments.

"update()" is also how your templates will receive data when they are on air. WebSockets are optional, not required.

If you are using 2.0.7 you should embed your json in xml tags. e.g. <data>{field1:\"title\"}</data>

If you are using 2.1.0 there is also a remote debugger available (I think it has to be activated either through the config file or through some parameters on startup)

The only way to get messages printed in the console is through console.warn or console.error
CasparCG enthusiast and broadcast geek