In this controller i got all the movienames
public ActionResult MultiText()
{
List<string> mnames = db.AllMovienames().ToList();
ViewBag.movies = mnames;
return View();
}
I need to send this "ViewBag.movies" to Javascript present in view
$(function () {
var availableTags = ViewBag.movies;
function split(val) {
return val.split(/,\s*/);
}
function extractLast(term) {
return split(term).pop();
}
$("#tags")
// don't navigate away from the field on tab when selecting an item
.bind("keydown", function (event) {
if (event.keyCode === $.ui.keyCode.TAB &&
$(this).data("ui-autocomplete").menu.active) {
event.preventDefault();
}
})
But i cant get values into view