0

im trying to implement typeahead in mvc 4.

(i included the the typeahead js and css.)

Im using this ajax method in order to get the list

$(function() {
         // get your list
         $.getJSON('/Main/GetServiceNames', function (allData) {
             $('#servicename').typeahead({source: allData});
         });
     });

This is the result of the ajax request :

["RetrieveDocument","PublishDocument","PublishFeedback","PublishSurvey","RetrievePartner","RetrieveLabelDocuments","RPCRetrieveZipCode","ESB2InfraService","PublishTest","PublishPolcy"]

But for some reason the result wont bind to the #servicename Html input
This is the html that im trying to bind to and none of the list is shown.

     <input type="text" class="form-control" placeholder="servicename" id="servicename" data-provide="typeahead"> 

EDIT: i managed to create the same error here typeahead fiddel

thanks

miki

MIkCode
  • 2,655
  • 5
  • 28
  • 46
  • I though the typeahead plugin was removed in Bootstrap 3..? http://stackoverflow.com/a/17904021/651789 – qxn Oct 29 '13 at 16:42
  • i added typeahead.js by myself https://github.com/twitter/typeahead.js/ and the typeahead css to – MIkCode Oct 29 '13 at 17:10

1 Answers1

0

Take a look at the example here. Also, keep in mind that Bootstra's typeahead.js is different from Twitter's typeahead.js, which I think you are using. You can get Bootstrap's typeahead.js here.

Dmitry Efimenko
  • 10,973
  • 7
  • 62
  • 79