title: Update or change typeahead data
body: <p>I'm using this typeahead library: <a href="http://twitter.github.io/typeahead.js/" rel="nofollow">http://twitter.github.io/typeahead.js/</a></p>
  
  <p>I managed to create a sample same as they have on their page with having local values. </p>
  
  <pre><code>$( document ).ready(function() {
    var globalResults = ["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Dakota","North Carolina","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming"];
  
    var substringMatcher = function(strs) {
      return function findMatches(q, cb) {
        var matches, substringRegex;
  
        // an array that will be populated with substring matches
        matches = [];
  
        // regex used to determine if a string contains the substring `q`
        substrRegex = new RegExp(q, 'i');
  
        // iterate through the pool of strings and for any string that
        // contains the substring `q`, add it to the `matches` array
        $.each(strs, function(i, str) {
          if (substrRegex.test(str)) {
            matches.push(str);
          }
        });
  
        cb(matches);
      };
    };
  
    $('#search-input').typeahead({
      hint: true,
      highlight: true,
      minLength: 1
    },
    {
      name: 'globalResults',
      source: substringMatcher(globalResults)
    });
  });
  </code></pre>
  
  <p>The problem is when I update the globalResults, the typeahead still shows the same old results Alambama, Alaska...</p>
  
  <p>I'm trying to update them this way, but it doesn't work:</p>
  
  <pre><code>globalResults = results;
  var autocomplete = $('#search-input').data('typeahead');
  autocomplete.source = globalResults;
  </code></pre>
  
  <p>Results are retrieved from a server in a string array. I debugged it and it contained the new data and it did copy them into globalResultes and updated it. But somehow this line does nothing:</p>
  
  <pre><code>autocomplete.source = globalResults;
  </code></pre>
  
  <p>Where might be the problem for which the source for typeahead is not updating?</p>
  
  <p>My html looks like this:</p>
  
  <pre><code>&lt;span style="position: relative; display: inline-block;" class="twitter-typeahead"&gt;
              &lt;input type="text" spellcheck="true" class="form-control typeahead tt-input" placeholder="Search for science, search for data ..." id="search-input" autocomplete="off"&gt;&lt;/input&gt;
  &lt;/span&gt;
  </code></pre>