Reputation: 205
View JavaScript:
$(document).ready(function() {
$("input#autocomplete").autocomplete({
source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
});
});
I want to call controller action. source:[ call action ]
Upvotes: 0
Views: 634
Reputation: 30095
From jQuery UI site http://jqueryui.com/demos/autocomplete/#remote:
$( "input#autocomplete" ).autocomplete({
source: "mysourceactionhere"
});
If your JS code on the view, you can use:
$( "input#autocomplete" ).autocomplete({
source: '@Url.Action("SourceAction", "SourceController")'
});
Upvotes: 1