Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <input class="typeahead form-control" placeholder="Type a city" type="text" />
  2.  
  3. $('.typeahead').typeahead({
  4. hint: true,
  5. highlight: true,
  6. minLength: 3,
  7. limit: 8 }
  8. , {
  9. source: function(q, cb) {
  10. return $.ajax({
  11. dataType: 'json',
  12. type: 'get',
  13. url: 'http://gd.geobytes.com/AutoCompleteCity?callback=?&q=' + q,
  14. chache: false,
  15. success: function(data) {
  16. var result = [];
  17. $.each(data, function(index, val) {
  18. result.push({
  19. value: val
  20. });
  21. });
  22. cb(result);
  23. }
  24. });
  25. }
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement