Hello i have this code in the controller :
ViewBag.localitate = db.Localitatis.OrderBy(p => p.Localitate).ToList();
and on the view i try to get it via:
<script type="text/javascript">
$(function () {
var availableTags = [
@foreach (var item in ViewBag.localitate)
{
@item.Localitate
}
];
$("#destination").autocomplete({
source: availableTags
});
});
</script>
I din't know how to format this in order to get an array like in the jquery demo example :
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
in order to make the autocomplete work with my values from database,
thank you