title: ajax requested json not populating flot chart
body: <p>I have created a php to return scores from the db through json encode. Flot just doesnt seem to want them. Theres no errors being returned in firebug. So i am stuck. All i get is a blank chart-</p>
  
  <p><img src="https://i.stack.imgur.com/oneUy.png" alt="enter image description here"></p>
  
  <p>The code..</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
  
      $(function() {
  
          var options = {
               bars: {
                  show: true
              }
          }
  
          $.plot("#placeholder", data, options);
  
          var iteration = 0;
  
          function fetchData() {
  
              ++iteration;
  
              function onDataReceived(series) {
  
                  data = [ series ];
  
                  $.plot("#placeholder", data, options);
              }
  
              $.ajax({
                  url: "http://localhost/charts/data",
                  type: "GET",
                  dataType: "json",
                  success: onDataReceived
              });
  
              if (iteration &lt; 5) {
                  setTimeout(fetchData, 10000);
              } else {
                  data = [];
                  alreadyFetched = {};
              }
          }
          fetchData();
          setTimeout(fetchData, 10000);
  
  
  
      });
  
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
      &lt;div id="header"&gt;
          &lt;h2&gt;AJAX&lt;/h2&gt;
      &lt;/div&gt;
  
      &lt;div id="content"&gt;
  
          &lt;div class="demo-container"&gt;
              &lt;div id="placeholder" class="demo-placeholder"&gt;&lt;/div&gt;
          &lt;/div&gt;
  
      &lt;/div&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The php that returns the data is </p>
  
  <pre><code>    $data = array(array('1999',3.0),array('2000',3.9),array('2001',2.0),array('2002',1.2)); 
      $array = array('label' =&gt; 'Scores','data'=&gt;$data);
      echo json_encode(array($array));
  </code></pre>
  
  <p>And the return Json is </p>
  
  <pre><code>[{"label":"Scores","data":[["1999",3],["2000",3.9],["2001",2],["2002",1.2]]}]
  </code></pre>