in my mvc project iam trying to implement the autocomplete But it is not working (typehead) i done everything right but can't get it. below is my code . can any one help
<script type=text/javascript>
$(document).ready(function () {
$(#Search).typeahead({
source: function (query, process) {
var countries = [];
map = {};
// This is going to make an HTTP post request to the controller
return $.post('/Registration/GetPossibleLocations', { query: query }, function (data) {
// Loop through and push to the array
$.each(data, function (i, country) {
map[country.Name] = country;
countries.push(country.Name);
});
// Process the details
process(countries);
});
},
updater: function (item) {
var selectedShortCode = map[item].ShortCode;
// Set the text to our selected id
$(#details).text(Selected : + selectedShortCode);
return item;
}
});
});
<script src=http://code.jquery.com/jquery-1.8.3.js type=text/javascript></script>
<script src=http://code.jquery.com/ui/1.9.2/jquery-ui.js type=text/javascript> </script>
<script src=http://twitter.github.io/typeahead.js/releases/latest/typeahead.bundle.js type=text/javascript></script>
<div>
<input type=text id=Search data-provide=typeahead placeholder=Country autocomplete=off />
</div>