title: I want to update an article every 5 minutes with javascript, can't get it to work
body: <p>I'm have been trying to get a single article on my website and have it swtich to another article on interval. I'm using flask to scrape the arcile title,image and text from 3 different source. Then I render a template with those elements in a list. </p>
  
  <p>See code:</p>
  
  <pre><code>@app.route('/test')
  def hello_world():
  offshorenergyfeed = feedparser.parse('https://feeds.feedburner.com/OffshoreEnergyToday?format=xml')
  offshorewindfeed = feedparser.parse('http://feeds.feedburner.com/OffshoreWindNews?format=xml')
  rechargefeed = feedparser.parse('http://www.rechargenews.com/rss/')
  feedlinks = [offshorenergyfeed.entries[0]['link'],offshorewindfeed.entries[0]['link'],rechargefeed.entries[0]['link']]
  artikel_tekst = []
  artikel_titel = []
  artikel_image = []
  for link in feedlinks:
      artikel = Article(link)
      artikel.download()
      artikel.parse()
      artikel_tekst.append(artikel.text)
      artikel_titel.append(artikel.title)
      artikel_image.append(artikel.top_image)
  
  
  return render_template('graph.html',
  artikel_tekst = artikel_tekst,
  artikel_titel = artikel_titel,
  artikel_image = artikel_image,
  )
  </code></pre>
  
  <p>Now I want to I want to display 1 article at the time and swtich it to another with an interval(lets say 5 minutes). For some reason I can only get it to work with the title switch. Text and Image won't switch with the given code:</p>
  
  <pre><code>  &lt;div id=newsarticle_container&gt;
       &lt;h1 id='titel'&gt;{{artikel_titel[0]}}&lt;/h1&gt;
       &lt;img id=plaatje src="{{artikel_image[0]}}"&gt;
       &lt;div id='tekst'&gt;{{artikel_tekst[0]}}&lt;/div&gt;
   &lt;/div&gt;
    &lt;script&gt;
  var titles = ["{{artikel_titel[0]}}", "{{artikel_titel[1]}}", "{{artikel_titel[2]}}"];
  var images = ["{{artikel_image[0]}}", "{{artikel_image[1]}}", "{{artikel_image[2]}}"];
  var text = ["{{artikel_tekst[0]}}", "{{artikel_tekst[1]}}", "{{artikel_tekst[2]}}"];
  var counter = 0;
  var elem1 = document.getElementById("titel");
  var elem2 = document.getElementById("plaatje");
  var elem3 = document.getElementById("plaatje");
  var inst = setInterval(change, 2000);
  
  function change() {
    elem1.innerHTML = titles[counter];
    elem2.innerHTML = images[counter];
    elem3.innerHTML = text[counter];
    counter++;
    if (counter &gt;= titles.length) {
      counter = 0;
  
    }
  }
  
   &lt;/script&gt;
  </code></pre>
  
  <p>Can someone please help me out. I have been struggeling on this for a long time. I think i'm close to the solution but maybe it's needs to be way different. Let me know. </p>
  
  <p>Thanks in advance!</p>