Typeahead 0.11.1 - How to tie Typeahead.js suggestions to a cross domain data source?

http://stackoverflow.com/questions/21520609/how-to-tie-typeahead-js-suggestions-to-a-cross-domain-data-source

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.11.1/typeahead.bundle.min.js"></script>
<input class="typeahead">

JavaScript

var mocks = new Bloodhound({
  datumTokenizer: function(datum) {
    return Bloodhound.tokenizers.whitespace(datum.value);
  },
  queryTokenizer: Bloodhound.tokenizers.whitespace,
  remote: {
            url: '/echo/json/',
           prepare: function (query, settings) {
           	settings.type = "POST";
           	settings.contentType = "application/json; charset=UTF-8";
           	settings.data ={json:'{"results":[{"value":"mock1"},{"value":"mock2"},{"value":"mock3"}]}'}
           	return settings;
  				},
        transform: function(response) {
        console.log(response);
      return $.map(response.results, function(data) {
        return {
          value: data.value
        };
      });
    }
    }
});
$('.typeahead').typeahead(null, {
  display: 'value',
  source: mocks
});