title: Javascript forcing csv file reload (amcharts)
body: <p>I am using apache on a raspberry pi to host a page for viewing on an internal network. The page consists of an amcharts graph displaying data from a csv file. The csv file updates every minute. Is there a way of forcing the graph to update? </p>
  
  <p>I've already tried the following methods:
  Using the meta tag in the html reload
  Using setTimeout in the javascript to force reload.</p>
  
  <p>The first method didn't work, the second works in some browsers (but not IE, which is what I need it to work in!)</p>
  
  <p>Basically, I need the browser to not cache the referenced csv file. Any suggestions much appreciated! I've included the js that references the csv file below, and can include the whole page if necessary.</p>
  
  <p>Thanks</p>
  
  <pre><code>            loadCSV("daily.csv");
          });
  
          function loadCSV(file) {
              if (window.XMLHttpRequest) {
                  // IE7+, Firefox, Chrome, Opera, Safari
                  var request = new XMLHttpRequest();
              } else {
                  // code for IE6, IE5
                  var request = new ActiveXObject('Microsoft.XMLHTTP');
              }
              // load
              request.open('GET', file, false);
              request.send();
              parseCSV(request.responseText);
          }
  
          function parseCSV(data) {
              //replace UNIX new lines
              data = data.replace(/\r\n/g, "\n");
              //replace MAC new lines
              data = data.replace(/\r/g, "\n");
              //split into rows
              var rows = data.split("\n");
  
              // loop through all rows
              for (var i = 9; i &lt; 19; i++) {
                  // this line helps to skip empty rows
                  if (rows[i]) {
                      // our columns are separated by comma
                      var column = rows[i].split(",");
                      // column is array now
  
                      // first item is date
                      var time = column[0];
                      // second item is value of the second column
                      var value = column[1];
                      // third item is in the fourth column
                      var value2 = column[5];
  
                      var value3 = column[3];
  
                      // create object which contains all these items:
                      var dataObject = {
                          time: time,
                          actual: value,
                          target: value2,
                          scrap: value3
                      };
                      // add object to chartData array
                      chartData.push(dataObject);
  </code></pre>